Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 38693

Summary: Color Distortion with PHP and GD Image Library
Product: Gentoo Linux Reporter: PJ <PJ>
Component: [OLD] DevelopmentAssignee: PHP Bugs <php-bugs>
Status: RESOLVED INVALID    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://us4.php.net/manual/en/function.imagecopyresized.php
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Code to demonstrate the bug.
What I see

Description PJ 2004-01-19 02:32:22 UTC
When using the imagecopyresize() and imagecopyresampled() functions, color distrotion occurs. This same code when ran on other systems performs normally. Only on my gentoo system does this distortion occur.

This occurs with the use flags GD, as well as GD External. This also occurs with CLI PHP and mod_php.

Reproducible: Always
Steps to Reproduce:
1.Run the attached script.

Actual Results:  
The image comes out funky

Expected Results:  
Make the image look the same, but smaller.

root@lair /root: emerge info
Portage 2.0.49-r21 (default-x86-1.4, gcc-3.3.2, glibc-2.3.3_pre20031222-r0, 
2.4.22-gentoo-r4)
=================================================================
System uname: 2.4.22-gentoo-r4 i686 AMD Athlon(tm) Processor
Gentoo Base System version 1.4.3.12
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-tbird -O3 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/s
hare/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=athlon-tbird -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu 
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X alsa apache2 apm avi berkdb crypt cups encode esd foomaticdb freetype gd 
gdbm gif gpm gtk gtk2 imlib jpeg libg++ libwww mad mbox mikmod motif mpeg 
ncurses nls oggvorbis opengl oss pam pdflib perl png python qt quicktime 
readline sdl slang spell ssl svga tcpd truetype x86 xml2 xv zlib"

root@lair /root:
Comment 1 PJ 2004-01-19 02:34:00 UTC
Created attachment 24066 [details]
Code to demonstrate the bug.
Comment 2 PJ 2004-01-19 02:35:21 UTC
Created attachment 24067 [details]
What I see

(Props go to Seemant for being my gennie pig).
Comment 3 SpanKY gentoo-dev 2004-01-19 05:31:46 UTC
i had this bug once and i got around it by doing this:
$localpic = "some.jpg";
$im = imagecreatefromjpeg($localpic);
$w = 100;
$h = 100;
$thumb = imagecreatetruecolor($w,$h);
$specs = getimagesize($localpic);
imagecopyresized($thumb, $im, 0, 0, 0, 0, $w, $h, $specs[0], $specs[1]);
$thumbfile = $localpic ."_thumb.jpg";
ImageJpeg($thumb,$thumbfile,100);

basically when i used imagecreate() i got the crappy quality and when i used truecolor, it worked fine

the reason can be found at the URL provided above