[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: jpegtran lossless rotation?



On Mon, 24 Jan 2005 05:57:30 -0600, Kirk Strauser <kirk@strauser.com> wrote:
> On Monday 24 January 2005 04:18 am, Victor Munoz wrote:
> 
> > Understanding nothing about the internals of graphic formats, I'd expect
> > that original and transformed files had the same number of bytes.
> 
> I wouldn't.  I can't imagine too many compression algorithms that would use an
> identical representation for two pieces of data, rotates 90 degrees.
> 
> Out of curiosity, what happens if you rotate l.jpg 3 more times?

test.jpg, rotated a few times:
first 90 degrees, then 270 and 90, and finally 270 again.

-rw-r--r--   1 olaf olaf  403804 2005-01-24 15:14 test-90-270-90-270.jpg
-rw-r--r--   1 olaf olaf  401727 2005-01-24 14:14 test-90-270-90.jpg
-rw-r--r--   1 olaf olaf  403804 2005-01-24 14:12 test-90-270.jpg
-rw-r--r--   1 olaf olaf  401727 2005-01-24 14:12 test-90.jpg
-rw-r--r--   1 olaf olaf  403788 2005-01-24 14:11 test.jpg

After the first transformation the sizes stay the same.

Probably due to a different huffman code table in the jpeg header. The
image data is still the same, the representation in the binary data is
different. Jpegtran does not decode DCT blocks within the jpeg. It
just stores them in a different encoding then the program which
originally created the jpg.

The original test.jpg and the test-90-270.jpg both create the same bitmap:

-rw-r--r--   1 olaf olaf 5760054 2005-01-24 15:44 test-90-270.bmp
-rw-r--r--   1 olaf olaf 5760054 2005-01-24 15:44 test.bmp

Comparing them with "cmp" shows no difference.

Nothing to worry about.

 -Olaf



Reply to: