Closed (fixed)
Project:
ImageCache
Version:
6.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Jun 2008 at 15:57 UTC
Updated:
26 Mar 2010 at 09:20 UTC
Is there anything in the API for getting image optimization into a preset? Most of the users who upload to image galleries don't have photoshop so just upload raw images. I have a "display" preset to scale inside dimensions to 640px. Without optimization the images are in the 300-400k range -- when I save-for-web in photoshop as 60-quality jpegs they end up in the 50k range.
many thanks ...
Comments
Comment #1
guidot commentedI don't know about imagecache-specific ways to do this, but if you are ok with one setting for all images, you can set the jpeg quality at http://example.com/index.php?q=admin/settings/image-toolkit
Comment #2
bogdrupal commentedyep, that will work, thanks
Comment #3
guidot commentedComment #4
dopry commentedI would be totally cool to have a 'generic' convert action that allows you to adjust quality and format... I'm making this a feature request.
Comment #5
MisterSpeed commentedThere are a few possibilities here; one would be a heuristic approach that reduces the quality of images until a certain maximum size (in kilobytes) is reached; the other would simply be an override of the generic image-toolkit settings only for the use of that module; a third is as proposed in the ticket intro: to constrain the resulting dimensions to a maximum bounding box. Which of these would users of the module find valuable ?
Comment #6
MisterSpeed commentedGuidance on this from the OP or the commentators would be much appreciated !
Comment #7
xalexas commentedCan somebody tell my why imagecache resamples images with applied scale action even if scaling is not necessary (image is smaller than scale dimension)? I have set image quality in image-toolkit to 100% but without any effect. I know i can put original images without scaling but i need scaling limit just in case if user upload bigger image than allowed.
Comment #8
smitty commentedDoes anybody know additional opportunities to optimize the images?
I'm using ImageCache and the Image Module and the thumbnails created by them get 28kb (109x109 pixels; Compression Quality: 75%). If I use 'save-for-web' in Photoshop (75% quality) they get only 5kb.
Changing the 'Compression Quality' in the ImageAPI has almost no effect. With only 10% quality the thumbnails get pretty ugly but they are still 26kb.
Comment #9
lop commentedYou can get the lowest filesize by removing all metadata (Exif, IPTC, XMP, ICC profile, embedded thumbnail) from images. And that is exactly what Photoshop's 'save-for-web' function is doing.
Unfortunately there is no ImageCache/ImageAPI action at this time to handle this.
But you can use ImageMagick raw action module to make a new ImageCache action with a simple command line option:
-stripand add it as a last action in a preset.Note: The -strip command line option is supported by IM 6.x only. For older versions you can try command:
+profile "*"Comment #10
Scott J commentedI think everything that you want is in 'ImageMagick Advanced Options' module - see http://groups.drupal.org/node/6699. It comes with, but is not dependent on, Image module, but works great for ImageCache as well. If you don't need the rest of Image module, this can be enabled by itself.
Your images will thank you for it........
Comment #11
Scott J commentedI just tried moving the
/sites/all/modules/image/contrib/image_im_advanced
folder to
/sites/all/modules/image_im_advanced/
and it seems to be happy all by itself, so that you don't have unnecessary modules cluttering your site.
Comment #12
smitty commentedThanks a lot for these hints!
ImageMagick raw action works perfectly for me.
I also tried the 'ImageMagick Advanced Options' module. But this module did nothing for me. I think the 'reason why' is: This module is connected to the Image Toolkit. But ImageCache uses the ImageApi module. So Probably it is never called while ImagaCache is doing its work for the image module via the "ImageCache 4 Image" module in Drupal 5.
Comment #13
Scott J commentedMaintainer Wanted
I asked the Image project team at http://drupal.org/node/735498 , but it turns out that "ImageMagick Advanced Options" module is an old project that has been through several pairs of hands, and the current maintainer knows nothing whatsoever about ImageMagick.
Further, he states that "If anyone wants to volunteer to maintain that particular module, that would be fantastic. I'm open to suggestions for moving it to ImageAPI too."
So, if anyone would like to try improving "ImageMagick Advanced Options", it's all yours.
Comment #14
jcisio commentedThis is an old topic. But...
I use ImageMagick/ImageAPI for Imagecache. On
?q=/admin/settings/imageapi/configI have compression quality 75%, the version is:The original image is
http://ms.thongtincongnghe.com/files/images/2010/3/11/lenovoideapads10-3... (130 KB, ok)
I use Imagecache to resize (action: scale, option: 216x72):
http://ms.thongtincongnghe.com/files/imagecache/gallery/images/2010/3/11... (13 KB)
When I ssh to the server, run the command:
convert path/to/src -thumbnail 216x72 -quality 75% lenovoideapads10-3tgal44.jpg.jpg
I have this:
http://ms.thongtincongnghe.com/files/imagecache/gallery/images/2010/3/11... (2.4 KB, only!)
When I try with 80%, I have 2.7 KB. All that mean that Imagecache result is far from optimal.
May we need a patch for the core ImageAPI ?
Comment #15
jcisio commentedJust look into the ImageAPI and found it. On the last stable version (6.x-1.6), I need to modify line 117, replace
-resizeby -thumbnail. It will fix the problem with my latest Imagemagick binary.Issue submitted for ImageAPI: #740476: Use -thumbnail instead of -resize