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:
Created attachment 24066 [details] Code to demonstrate the bug.
Created attachment 24067 [details] What I see (Props go to Seemant for being my gennie pig).
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