HI all, we've been running into some server load issue with a massive influx of traffic.One of my customers is being featured on TV and the their site is getting hammered. Anyway, long story short,we're aggressively optimising the homepage.

The homepage features a slideshow of 4 largish images 700x280px. I've optimised these images in photoshop and saved for web. I'm happy with the quality and each one is around 30-40k. After uploading and running through my imagecache action to add round corners. The file size increase to 100k +

I tried all of the imageAPI compression settings. At 100% i'm seeing 70k added to the file size. At lower quality 75%, the file size is still bigger that the original save for web version, and has more noticeable compression artifacts.

What can I do? The slideshow is managed by the client so they need to keep this flexible allowing them to control the images and update on a regular basis.

I seen plenty of posts that touch on this issue, but haven't found any solutions.Any help much appreciated.

Comments

Exploratus’s picture

Priority: Normal » Critical

I have this problem too. When I upload a large image (lets say 300kb) and then create a mini thumbnail, the image is like 40kb for a 40x35 px image. It should be 3-4kb. THis is really getting to be a problem with imagecache for me, as many users submit images that arent optimied for the web.

It seems strange that imagecache and imageapi dont optimize images when they do their magic. I am using ImageMagick at 35%, and the image is still huge. If I take that same image and put it into photoshow and save for web at 60% the file is 80-90% smaller (as it should be). This really is a big problem imo.

ImageMagick, Imagecache and ImageApi do not seem to be very efficient at compressing images for web. Seems strange considering that this is for a website.

Now before anybody tells me anything about image manipulation. I am a graphic artist and know photoshop and all that stuff very extensively. I do professional photography and I am veeeery knowledgful regarding image sizes, appearence, etc. The images being resized and resaved by this combo of software is sometimes doing an even worst job that a standard (not for web) photoshop save. IMO, images saved through this combo should be as efficient as saving an image for web in photoshop, not comparable to a standard save.

I mean, come on, how can a 60x40 image created from ImageCahce and ImageAPI using ImageMagick be 30KB??? I dont care how big the original file is, its 60px by 40px of data supposed to be saved and optimized for the web. 30KB is ridiculous...

jonhattan’s picture

hixster’s picture

Jon , unless i'm missing something, those links are more geared to establishing which image quality settings have been used to compress an image - where as this thread is more about achieving a good balance between image quality and file size using imagemagik , via imagecache in Drupal - which doesn't seem to produce desirable results.

jonhattan’s picture

Well, I'm mainly concerned of the filesize and let me say I'm less than an average user in this area.

OP set Component: ImageAPI GD and comment #1 speaks about imagemagik. I did test both gd and imagemagik with similar results. So I did some tests with GIMP, also with similar results:

Original image: http://placekitten.com/600/400
This image (400.jpeg) is 30KB and was compressed at a estimated quality of 85%:

$ identify -verbose 400.jpeg  |grep Quality
  Quality: 85

I did open it with GIMP and resaved at 75%, 85% and 100%. Those are the results.

-rw-r--r-- 1 jonhattan jonhattan 69K 2011-03-24 08:58 400_100.jpeg
-rw-r--r-- 1 jonhattan jonhattan 26K 2011-03-24 08:58 400_75.jpeg
-rw-r--r-- 1 jonhattan jonhattan 29K 2011-03-24 08:58 400_85.jpeg
-rw-r--r-- 1 jonhattan jonhattan 30K 2011-03-24 08:57 400.jpeg

* Size of 400_85.jpeg is close to size of 400.jpeg. It is fine but the quality of the original image may not be always the same.
* 100% quality of an image previously compressed at 85% is not the same size of the original image, as it could be expected (I did expect it). I did set 100% in the aim to not loose quality.

Then I did the same with 400_75.jpeg:

-rw-r--r-- 1 jonhattan jonhattan 69K 2011-03-24 08:59 400_75_100.jpeg
-rw-r--r-- 1 jonhattan jonhattan 26K 2011-03-24 08:59 400_75_75.jpeg
-rw-r--r-- 1 jonhattan jonhattan 30K 2011-03-24 08:59 400_75_85.jpeg
-rw-r--r-- 1 jonhattan jonhattan 26K 2011-03-24 08:58 400_75.jpeg

and then the same with 400_100.jpeg:

-rw-r--r-- 1 jonhattan jonhattan 73K 2011-03-24 09:01 400_100_100.jpeg
-rw-r--r-- 1 jonhattan jonhattan 26K 2011-03-24 09:00 400_100_75.jpeg
-rw-r--r-- 1 jonhattan jonhattan 29K 2011-03-24 09:00 400_100_85.jpeg
-rw-r--r-- 1 jonhattan jonhattan 69K 2011-03-24 08:58 400_100.jpeg
mshick’s picture

I am seeing a similar problem with PNG. When I upload a Photoshop optimized, 920x475, PNG-24 image at 100k, it is bloated to 377k by ImageAPI. The only operations being performed are a minor size decrease. Also, I'm using GD2.

I've tried every compression setting, and tested out ImageAPI Optimize, but it didn't get me anywhere. Optimize decreased the filesize slightly, but the original ImageAPI/GD2 generated image it works with has already been bloated so greatly that it makes little difference.

Is there a known issue with PNG resizing and ImageAPI / GD2?

Thanks!

max36’s picture

The increased size has got something to do with Image-Information like EXIF-Info etc. Photoshop Web-Optimization strips the unnecessary Info, but ImageAPI seems to add it again.

I tried this module: https://drupal.org/project/imageapi_optimize and the result is much smaller files...

The configuration might be a little tricky, but you can also use the webservice smush.it to optimize the images

mrfelton’s picture

I concur with mshick's findings in #5 - I have a 30k image, optimised in photoshop. I'm using the image_api_optimize toolkit, and I have the imageapi compression setting to 95%. If there are no transformations in my imagecache preset, then the size of imagecache's generated image is good. As soon as I add a transformation to my imagecache preset (in this case, I'm using a scale transformation which scales the image to its original size - so no actual change in size at all), the filesize jumped to 70K!

mrfelton’s picture

See #1312132: Exactly what gets optimized, and when. ImageAPI Optimise is simply not going to help. I believe that it all depends of wether your ImageAPI compression setting is the same or different from the compression setting that you used to save the original image in photoshop. If that is the case, then I think that #924304: Allow presets to override JPEG quality setting and #1113530: Changing jpg quality does not seem to work are relevant to this discussion too, since those will allow you to configure that setting per preset.