Reduce thumbnail size in eZ publish by stripping EXIF data

Have been working on a refresh of the willow site and could not work out why the majority of thumbnail images were 20K yet others were 2K. I stumbled on the issue when a bug with the handling on EXIF data presented itself.

When ImageMagick scales images it will copy any EXIF data unless told not to. The images on the willow site contained approximately 18K of EXIF data and this was being copied into the thumbnail variations.

eZ publish makes it easy to add filters for image variations. Simply add the following line to image.ini.append.php in your siteaccess file:
[ImageMagick]
Filters[]=strip=+profile "*" +comment

[small]
Filters[]=strip=
This will strip EXIF information for "small" image variations and can be added to others by simply adding the Filters[] line to the variations definition.

Newer versions of ImageMagick have a -strip flag that will also remove EXIF data. To use this replace the [ImageMagick] section with:
[ImageMagick]
Filters[]=strip=-strip
This will work on all versions of eZ publish 3 that are using ImageMagick to create image variations.

This has reduced the page size of some of the willow collection pages from 856 kb to 168 kb !

Comments

Post a Comment

Popular posts from this blog

eZ Publish Admin Prototype extension

eZ Publish Admin redesign - Dashboard = OpenSocial?

eZ Publish 5 Virtual Machine