Closed (outdated)
Project:
ImageMagick
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
24 Jan 2012 at 17:01 UTC
Updated:
20 Jan 2025 at 15:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sunGood idea - although this requires each image style (or effect?) to (optionally) supply the quality.
http://drupal.org/project/modules?text=imagemagick reveals among others:
http://drupal.org/project/imagecache_qualityhttp://drupal.org/sandbox/dokumori/1310444
Could that idea be merged into the imagemagick_advanced sub-module?
Comment #2
marcoka commentedsome notes, minds.
as far as i analyzed/worked out the logic, core would still need the patch:
#1310452: Allow to override the image toolkit's global JPEG/PNG quality value
not the full patch, because we could skip the gd patch part here. but we need that to actually get the style so we can get the custom set quality.
http://screensnapr.com/v/af8t5q.jpg
Comment #3
marcoka commentedok my first suggestion. two patches.
1.) adds the ability to add a custom quality setting per preset
http://screensnapr.com/v/iHk4G2.jpg
2.) Is a patch for includes/image.inc and modules/image/image.module
passing through the $styles array, so one could get the settings of the style (image quality field) and replace it inside $args of imagemagick.
i have no idea how to do it without patching core. whats your opinion sun? any other suggestions?
Comment #4
sunUnfortunately, I don't really have time to look into this right now.
However, I can't believe that this requires to patch core. Especially, because the quality parameter is set and contained in imagemagick.module, so its value is under our authority.
Comment #5
marcoka commentedNo rush, i post what i got and if you have time you can look at it.
You were right, no core patch required. So to the new idea (thx to blackice).
The idea i followed now is adding the custom quality to the image object $image:
To alter the quality i had to pass the $image trough to imagemagick_advanced_imagemagick_arguments_alter(&$args, $context, $image)
so here i used the custom quality to alter the global quality.
Comment #6
marcoka commentedComment #7
sam152 commentedThis has been addressed without the use of any core hacks or work arounds in a clean and simple module.
Download Image Style Quality
Comment #8
marcoka commentedDHSamB, question is, is your module working for imagemagick or gd or both?
Comment #9
sunI've looked at the code of that Image Style Quality module, and I'm pretty confident that it will cause major problems.
Anyway, I actually think this could be directly added to Drupal core, so I've rolled an entirely new patch in:
#1310452: Allow to override the image toolkit's global JPEG/PNG quality value
At least the $image->quality tweak that essentially allows to override the quality could be backported to D7 (unless the whole thing can be backported).
Comment #10
sam152 commentedsun, can you please elaborate on the major problems the module is likely to cause?
Thanks.
Comment #11
fietserwinI fixed it in the imagecache_actions module for the "change file format" effect that also allows to define the quality. Unfortunately, it won't work for GD as that indeed needs a core patch. However, for imagemagick it would have been easier if the default quality is added at the beginning of the processing (image_imagemagick_load) instead of at the end (image_imagemagick_save). That way, a custom effect can either change the current setting or just add another op (preferred imo) to override the default setting.
Please note that the "quality" setting can equally well be used for PNG, so there should be no mention of or restriction to jpg.
Related imagecache_actions issue: #1113530: Changing jpg quality does not seem to work.
Comment #12
mondrakeDrupal 7 is EOL