Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] rotated90cw_view - jpeg lossless rotation
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2009-12-06 11:13:00


Christian Henning wrote:
> Hi Jose, please see comments below.
>
> On Sun, Dec 6, 2009 at 5:10 AM, Jose <jmalv04_at_[hidden]> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net