Page 1 of 1

-rotate more than double jpg size

Posted: 2018-11-15T10:41:50-07:00
by coolnodje
I'm trying to "just" rotate some jpg & png images in a folder
`magick mogrify -rotate 180 *.jpg`

this works fine but all jpg images almost triple in size.

This doesn't seem to happen with png located in the same folder: most increase very slightly in size (a few Kb), some would also go roughly x2.5 in size.

How can this be explained? Preview on Macos does this perfectly, all be it with a few Kb change in size.
Is there a way to avoid the size increase?

Re: -rotate more than double jpg size

Posted: 2018-11-15T11:04:02-07:00
by snibgo
IM reads the jpeg file, decompressing it. Then it does whatever you want. Then it re-compresses and writes the file.

For your operation, jpegtran (which is more special-purpose than IM) won't decompress and re-compress.

Re: -rotate more than double jpg size

Posted: 2018-11-18T15:35:42-07:00
by muccigrosso
Could you also use exiftool to alter the orientation tag of your jpegs?

Code: Select all

exiftool -Orientation=3 <filename>
Some apps will ignore this tag (like IM), which is why it might not work for you.

Re: -rotate more than double jpg size

Posted: 2018-11-18T16:40:53-07:00
by fmw42
IM uses the orientation EXIF tag, if it exists, when doing -auto-orient. See https://imagemagick.org/script/command- ... uto-orient

Re: -rotate more than double jpg size

Posted: 2018-11-18T18:23:59-07:00
by muccigrosso
Good to know, though it still re-compresses when that option is chosen.

Re: -rotate more than double jpg size

Posted: 2018-11-18T18:46:26-07:00
by fmw42
ImageMagick always decompressed and recompressed JPGs even when only modifying the Meta data such as with -set comment. So you should probably look for some other tool as snibgo suggested above.