Skip to content

JPEG auto-rotate changes image size #3806

Answered by jcupitt
palexvs asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @palexvs,

I think this is because imagemagick tries to "guess" (from an examination of the huffman tables) the Q factor a JPEG was compressed with, and then by default will reencode with this same Q.

Using your example1:

$ vips copy example1.jpeg vips-90.jpg[Q=90]
$ vips copy example1.jpeg vips-75.jpg
$ convert example1.jpeg im.jpg
$ ls -l vips-* im.jpg example1.jpeg 
-rw-r--r-- 1 john john  780499 Jan  3 10:39 vips-75.jpg
-rw-r--r-- 1 john john 1738178 Jan  3 10:38 vips-90.jpg
-rw-rw-r-- 1 john john 1812478 Jan  3 10:38 im.jpg
-rw-rw-r-- 1 john john 1648867 Jan  3 10:37 example1.jpeg

So it looks like your original has been encoded with Q90. imagemagick tried to guess this setting and…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by palexvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3805 on January 03, 2024 10:45.