jpeg converted image get bigger than the original jpeg?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
buncee
Posts: 6
Joined: 2013-11-27T13:44:24-07:00
Authentication code: 6789

jpeg converted image get bigger than the original jpeg?

Post by buncee »

I'm new to ImageMagick so pardon me if this is a really stupid question.

I ran the command :
convert -format %w,%h, input.jpg -resize MxM> -identify output.jpg

where M is the longest dimension of the image, say the input is 1024x768, then M=1024, so I'm assuming the dimension of output image will be the same (and it is). However the image size get larger after converted. Say the input is 845941 bytes, the converted image using this command is 901649 bytes. Why is this?

I'm using ImageMagick 6.8.2 and the test input images are Windows sample pictures (the JPEGs that come with the Windows system).

Another question, I've heard that when ImageMagick do convert, it removes the header of the image. Is this true?

Thanks.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: jpeg converted image get bigger than the original jpeg?

Post by snibgo »

IM reads the jpeg and decompresses it, does any processing, then re-compresses and writes it. You can adjust the amount of compression (and hence the quality) with "-quality".

However, jpeg is a lossy compression method. Everytime you read and write in jpeg, you always lose quality.
Another question, I've heard that when ImageMagick do convert, it removes the header of the image. Is this true?
I don't even know what it means.

IM is wonderful at processing images but doesn't bother much about metadata. See the recent thread viewtopic.php?f=1&t=24537
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: jpeg converted image get bigger than the original jpeg?

Post by Bonzo »

Another question, I've heard that when ImageMagick do convert, it removes the header of the image. Is this true?
What happened when you tried it?

If you -resize no data is stripped unless you specify -strip and then the EXIF data etc. is removed ( I can not remember if the colour profile is stripped ). If you use -thumbnail it is the same as using -resize and -strip.
Post Reply