Christian Henning wrote:
Hi Jose, please see comments below.
On Sun, Dec 6, 2009 at 5:10 AM, Jose
wrote: I rotate jpeg photos to portrait by reading the file and saving it like this:
boost::gil::jpeg_write_view(file, boost::gil::rotated90cw_view(boost::gil::view(img)));
results:
original size: 4106172 image/jpeg 3264 2448 rotated size: 5594681 image/jpeg 2448 3264
The rotation should be lossless (as the image is a multiple of the jpeg MCU) but the size has increased significantly and the exif tags disappeared.
I think libjpeg has a way of applying lossless transformations while reading it. Is that correct, or am I mistaken here?
JPEG lossless transformation is a trick performed on the compressed JPEG data (IIUC, you basically shuffle the values in each block), and can therefore not be achieved by using a generic image library that provides a JPEG reader and writer. You need specialized functions that operate on the compressed JPEG data. Sebastian