Weblog entry #282 for simonw
#282
Image Manipulation - JPEG thumbnail size in bytes
Posted by simonw on Mon 20 Oct 2008 at 12:41
Well known to the authors of ImageMagick but...
One of our thumbnail utilities wasn't stripping JPEG profile data, when creating a thumbnail from a JPEG, which results in thumbnail bloat.
This can easily add 60Kb to an image.
ImageMagick's "convert -strip" does the job:
On a 63x96 pixel thumbnail....
Before:
67755 thumb.jpg
After:
6469 thumb-strip.jpg
Use of ImageMagick "thumbnail" methods rather than "resize" methods avoids this, since they call "strip" for you. Always read API carefully to see if there is a better method.
One of our thumbnail utilities wasn't stripping JPEG profile data, when creating a thumbnail from a JPEG, which results in thumbnail bloat.
This can easily add 60Kb to an image.
ImageMagick's "convert -strip" does the job:
On a 63x96 pixel thumbnail....
Before:
67755 thumb.jpg
After:
6469 thumb-strip.jpg
Use of ImageMagick "thumbnail" methods rather than "resize" methods avoids this, since they call "strip" for you. Always read API carefully to see if there is a better method.