[lug] 2.6M Lossless jpeg rotations?
Bear Giles
bgiles at coyotesong.com
Sun Jul 20 17:16:36 MDT 2003
Jeffrey Veiss wrote:
> Hi all,
>
> I've read that jpegtran from the v6b JPEG library is supposed to
> perform "Lossless JPEG transformations" and I'm a little confused
> about what that actually means.
>
> I have a jpeg from my camera that, according to gqview, has the
> following properties:
>
> file size: 867,475
> dimensions: 1280x960
> compression: 17.6%
> image size: 4.7MB
>
> After rotating it with "jpegtran -rotate 270", gqview reports the
> properties to now be:
>
> file size: 840,678
> dimensions: 960x1280
> compression: 30.4%
> image size: 2.6MB
Try stripping the cruft from the original file. You might find
the original image file was only about 2.6MB, with 2.1MB of
various cruft.
In general, you would be surprised how much faster a website can
be made by stripping the cruft from images, then resaving them as
interlaced images. The former eliminates the need to download
stuff that the client never needs to see, the latter actually
bumps the image size slightly but it's offset by the perception
that the download proceeds faster since the HTML rendering engine
can quickly stablize the results and things then just get sharper.
I believe that the "lossless rotation" promised by jpegtrans is
exactly that - it uses byte manipulation of the data blocks to
perform the rotation, not a decompression/swap/compression cycle.
> However, I loaded the original and jpegtran-rotated image into Adobe
> Photoshop and took a look at the properties of each:
>
> Original:
> Document size: 8.889" x 6.667"
> Resolution: 144 pixels/inch
>
> after jpegtran:
> Document size: 13.333" x 17.778"
> Resolution: 72 pixels/inch
Photoshop puts a lot of cruft into image files, just so you know.
I don't know why jpegtran changed the image resolution, but I
believe you can force it via the command line. Or you could
easily change it by hand... JFIF files (which contain JPEG images,
long story....) have a fairly simple format. It's dealing with
the compressed image data that makes you want to run into the night.
> I think it's interesting that Photoshop reports that the
> DPI was cut in half but the Document size was doubled.
Not really. It's computing the dimensions from the number if
pixels and the stated DPI.
Bear
More information about the LUG
mailing list