Imagemagick has been creating rediculously large thumbnails on my server -> i.e. 30-40kb for a 100x75 image. After some investigation, I solved it by hard-coding the "-strip" parameter into the _image_enhanced_scaling_convert function on line 268 as so:

$err = _image_exec("$convert_path -strip $filter $source $dest");

Now, when imagemagick builds a thumbnail it comes out between 2-4kb, which is a Massive difference. It seems like everyone in the drupal community would be interested in this, so I think it should either be a the default, or a checkbox in the config screen could be added to enable this.

CommentFileSizeAuthor
#5 image_enhanced_scaling-strip-070624.patch4.17 KBzoo33

Comments

zoo33’s picture

Not a bad idea. You'd lose the color profile in all derivative images, which may be fine for thumbnails but perhaps not so good in larger derivatives (which users may want to use for different things). There could be an option for that though: "Strip profiles in derivative images smaller than: XXXX pixels".

gravit’s picture

That's True - the profile would be removed from all derivatives... but I am pretty sure that most browsers (other than safari) don't take into account color profiles anyway. Unless someone was going to use a derivative JPG as a master image to edit in a program like photoshop, the "embedded" profile isn't going to matter. What does matter is the process of actually converting the image to a profile. This actually will alter the image information and is quite a bit different than the process of "assigning" a profile. I may be wrong - but this is my experience over the years as a professional photographer who has tweaked the heck out of my digital color workflow.

This is why in photoshop - the Save for web option does not include a color profile - and the correct process when dealing with adobe rgb images is to convert them to srgb before saving to web.

Either way, users love options - But I figure if you want to do any sort of editing that requires original metadata, you are going to want the original image anyway.

Thanks for the great work on this module BTW!

zoo33’s picture

Yes, I agree with everything you say. A good solution would be to first convert the image to the profile of your choice (rRGB) and then stripping it. Most programs will either assume the image is sRGB or render it in a way similar to that.

The only case where stripping the profile is not desired is if the derivative is to be used outside of the web page. I'm working on a website for a photo agency, and they provide their customers with composition images that they use in their page layout programs etc. So I'd like to be able to keep the embedded profile in that derivative size. There may also be other metadata in the image that could be useful for those clients, such as keywords, photographer's name etc.

gravit’s picture

Wow! I didn't think of the stock photo market - I guess that would make sense that you would want a profile on images other than the original.

Again, thanks for your work on this module! It is a priceless necessity.

zoo33’s picture

Assigned: Unassigned » zoo33
Status: Active » Needs review
StatusFileSize
new4.17 KB

Right, here's a patch which adds a setting that lets you choose what sizes should have their metadata stripped. Seems to work like a charm. My thumbnails are reduced from roughly 40 k to 20 k. It all depends on what quality setting you use.

A second opinion would be nice however before I commit it.

Thanks to radscientist for the good idea.

drewish’s picture

the imagemagick.inc file included with the 1.4 image.module has an option for -strip.

zoo33’s picture

Yeah... I'd still like to be able to choose what sizes are stripped. I think I'll wait and see what the outcome of 155313 will be.

zoo33’s picture

Status: Needs review » Closed (won't fix)

So, as we already have a great solution for this in the next major version of Image (see the issue linked to above) I won't be working on implementing -strip in this module.