Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Page 1 of 3
Avoid image compression with GD2
 
PitchOu
Member
 
Total Posts:  38
Joined:  2008-02-04
Villeneuve d'Ascq, France
 

Hi,

I would like to get a fine control on the quality of my product images. In others terms, I’d like not to use GD to compress my pictures.

Today I upload images in jpg 100% and I already setted the quality to something better than the default value (in lib/Varien/Image/Adapter/Gd2.php) but the result is not good for all image types (depending on the size, product, ...).

I would like to disable the Gd2 processing in the image caching system to replace it by a simple file copy ... in order to avoid any processing and keep a “human validated” quality wink

Any idea to do this properly ?

Thanks !

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mark_Kimsal
Sr. Member
 
Total Posts:  186
Joined:  2007-09-12
Michigan, USA
 

Can you unload the GD module from the server?  If that’s possible and practical (no other projects need it) then do it and search for my post about “gd got you down?” That post will show you how to compensate for a missing GD extension and use the regular images that you’ve uploaded.

 Signature 

There’s info on lots of custom modules in my Magento Group
http://www.magentocommerce.com/group/view/174
Need Upgrade help from 0.6, 0.7, and 0.8 available?  P.M. me for details on CMS integration.

 
Magento Community Magento Community
Magento Community
Magento Community
 
PitchOu
Member
 
Total Posts:  38
Joined:  2008-02-04
Villeneuve d'Ascq, France
 

Thanks for your reply. Unfortunately if I disable the php gd extension + delete image cache no more product is displayed in the shop.

I’ll need to look at the code, but I don’t really know how to manage this right.

Varien, any advise about the method ? Where would you make changes for this feature ?

Thanks !

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagentoJoe
Sr. Member
 
Total Posts:  127
Joined:  2007-08-31
 

I would also very much like to see an option in the admin-area where we could ajust the image-quality wanted for uploaded images.

 Signature 

Visit http://www.ecommerce-extensions.com for professional Magento templates and widgets.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lee Nugent
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2008-03-27
 

I’d like to sort out the default image compression.  I’m a strong believer that good images sell more products… GD2 settings currently dont cut the mustard!

Lee.

 
Magento Community Magento Community
Magento Community
Magento Community
 
PitchOu
Member
 
Total Posts:  38
Joined:  2008-02-04
Villeneuve d'Ascq, France
 

If you use only jpg images, you can change the code like this in lib/Varien/Image/Adapter/Gd2.php :

Change
case IMAGETYPE_JPEG:
imagejpeg($this->_imageHandler, $fileName);
break;

to

case IMAGETYPE_JPEG:
imagejpeg($this->_imageHandler, $fileName, 95);
break;

To get a default compression of 95% instead of the default value (75%).

Hope it helps !

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdb
Sr. Member
 
Avatar
Total Posts:  223
Joined:  2007-11-13
coastal California, USA
 

this is a great thing to know. i haven’t noticed any issues with the default 75%, but then again i use lineart instead of photos.

 Signature 

my preferred host: http://www.schostpro.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
circa1977
Member
 
Total Posts:  48
Joined:  2008-03-01
 

Does that solution actually work? Same thing that happened to me on the thread below happens when I try to apply this fix:

http://www.magentocommerce.com/boards/viewthread/7822/#t33356

Mark

 
Magento Community Magento Community
Magento Community
Magento Community
 
circa1977
Member
 
Total Posts:  48
Joined:  2008-03-01
 

I actually don’t even see that supported in PHP documentation.

- Mark

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shpigford
Sr. Member
 
Avatar
Total Posts:  150
Joined:  2007-09-03
Denver, CO
 

circa1977, make sure you are modifying imagejpeg() and NOT imagecreatefromjpeg().

 Signature 

Hi, my name is Josh. I run a little toy store and an interactive development company.
Download my Bizrate/Shopzilla Data Feed

 
Magento Community Magento Community
Magento Community
Magento Community
 
circa1977
Member
 
Total Posts:  48
Joined:  2008-03-01
 

Thanks, Josh. That worked much better.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sherrie
Enthusiast
 
Avatar
Total Posts:  872
Joined:  2007-12-14
Illinois, USA
 

It looks so much better now!  Thanks!

 Signature 

Creativity is falling in love with the world. – Dewitt Jones
Current Projects: Aqua Gear Direct & IHSA State Finals • Currently Running: PHP 5.2.5/MySQL 5.0.45/Magento 1.1.8 on HostGator

 
Magento Community Magento Community
Magento Community
Magento Community
 
scree
Sr. Member
 
Avatar
Total Posts:  94
Joined:  2008-07-14
Linz
 

worked for me, but image upload is broken now.

 
Magento Community Magento Community
Magento Community
Magento Community
 
John R
Sr. Member
 
Total Posts:  87
Joined:  2008-08-21
 

Did this change since the newest release?

case IMAGETYPE_JPEG
imagejpeg($this->_imageHandler$fileName); 
break;

.. does not appear to be anywhere in Gd2.php ..

 
Magento Community Magento Community
Magento Community
Magento Community
 
scree
Sr. Member
 
Avatar
Total Posts:  94
Joined:  2008-07-14
Linz
 

Try to change the quality in

/app/code/core/Mage/Media/Model/File/Image.php

on line 168 from

$result imagejpeg($object->getTmpImage(), $object->getFilePath(true), 80);

to

$result imagejpeg($object->getTmpImage(), $object->getFilePath(true), 95);

 
Magento Community Magento Community
Magento Community
Magento Community
 
AngelEyes
Member
 
Total Posts:  41
Joined:  2008-02-25
 

Scree,

Brilliant, thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 3
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
53162 users|607 users currently online|107168 forum posts