Google Answers Logo
View Question
 
Q: PHP: Differing GD's creating poor images ( No Answer,   1 Comment )
Question  
Subject: PHP: Differing GD's creating poor images
Category: Computers > Programming
Asked by: shane43-ga
List Price: $5.00
Posted: 06 Apr 2004 12:24 PDT
Expires: 22 Apr 2004 19:28 PDT
Question ID: 326155
I have a script that will take an image and resize it using PHP's GD
library. When I use it on server A, the image created looks pretty
good. However, when I use the same script on server B, the image
colors get distorted and appear grainy.

I would like to know what server settings / installations I need to
change on server B to make the image production appear more like on
server A. This is a little surprising considering the GD library on
server B is more recent than server A.

Here are examples:

Note: the picture is of a woman in a bikini - sorry if it offends
anyone (it was the most accessible picture I had at the time).


Script source:
http://shanescripts.com/imgtest/imagetest.php.txt
I ran this script on 2 servers. I copied the created images to 1 server below.

Good Server A:
http://shanescripts.com/imgtest/100-0001_IMG_2_a.JPG

gd settings gotten from phpinfo():
GD Support enabled 
GD Version 1.6.2 or higher 
FreeType Support enabled 
FreeType Linkage with freetype 
JPG Support enabled 
PNG Support enabled 
WBMP Support enabled 


Bad Server B:
http://shanescripts.com/imgtest/100-0001_IMG_2_b.JPG

gd settings gotten from phpinfo():
GD Support  enabled  
GD Version  bundled (2.0.17 compatible)  
GIF Read Support  enabled  
JPG Support  enabled  
PNG Support  enabled  
WBMP Support  enabled  
XBM Support  enabled  


Thank you so much for your time,
Shane Niebergall
Answer  
There is no answer at this time.

Comments  
Subject: Re: PHP: Differing GD's creating poor images
From: minychillo-ga on 07 Apr 2004 03:23 PDT
 
On GD 2.0 or higher you need to use ImageCreateTrueColor instead of
simple ImageCreate and you will get good quality. You should also use
ImageCopyResample instead of ImageCopyResized (also only available in
GD 2.0 or higher) to get better result after resizing. It uses bicubic
resizing.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy