Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] rotated90cw_view - jpeg lossless rotation
From: Jose (jmalv04_at_[hidden])
Date: 2009-12-06 12:03:23


On Sun, Dec 6, 2009 at 4:50 PM, Lubomir Bourdev <lbourdev_at_[hidden]> wrote:

[[ forgot reply all]]

> Rotation is lossless, but the jpeg format is not.

Lossless rotation is supported libjpeg release 7 (2005), but most
Linux systems I have check come with version 6.
http://jpegclub.org/jpegtran/

Using GIL
original size: 4106172 image/jpeg 3264 2448
rotated size: 5594681 image/jpeg 2448 3264

Using jpegtran -rot 90 -perfect
4106172 image/jpeg 3264 2448
4073598 image/jpeg 2448 3264

Note that jpegtran also removes exif tags, but if not the size would
be the sime (as I understand lossless transform).

>There is a quality setting
> in the jpeg parameters that affects file size. I believe the new jpeg IO
> that Christian wrote exposes that setting, Christian is that true?

The current GIL already has a quality parameter (third param of
jpeg_write_view) but for the above GIL experiment I assumed
default quality=100 so that no loss was introduced by change in quality.

>> What can I do make sure the exif tags are preserved ?
> Christian, is this possible?

Another option is to keep the original photo as it is and rotate
before resampling (but I couldn't compile it).
What type magic am I missing ?

TYPE myview = boost::gil::rotated90cw_view(boost::gil::view(img);
 boost::gil::resample_pixels(myview, boost::gil::view(fin), mat,
bg::bilinear_sampler());
 boost::gil::jpeg_write_view(file_out, boost::gil::const_view(fin), quality);

thanks


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