#23792 [Fbk->Opn]: 8 bit graphics don't rotate properly

From: Date: Sun, 25 May 2003 01:06:44 +0000
Subject: #23792 [Fbk->Opn]: 8 bit graphics don't rotate properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40365@lists.php.net to get a copy of this message
ID: 23792 User updated by: phpman at priya dot 2y dot net Reported By: phpman at priya dot 2y dot net -Status: Feedback +Status: Open Bug Type: GD related Operating System: Linux 2.4 PHP Version: 4.3.2RC4 New Comment: Well, the first comment used the image from the first link and included the script on the page $pic = imagecreatefrompng("pointer8bit.png"); $backcolor = imagecolorat($pic,1,1); $pic = imagerotate($pic,$_GET['r'],$backcolor); header('Content-type: image/png'); imagepng($pic); The second comment uses simlar script to produce a transparent version of the same process $base = imagecreatefrompng('windspeed.png'); #Load background the png $pic24bit = imagecreatefrompng("pointer.png"); #Load the pointer png $pic24bit = imagerotate($pic24bit,45,imagecolorat($pic24bit,1,1)); #Rotate the pointer png $pic8bit = imagecreate(imagesx($pic24bit),imagesy($pic24bit)); #Create a new image imagecopy($pic8bit,$pic24bit,0,0,0,0,imagesx($pic24bit),imagesy($pic24bit)); #Copy the 24 bit png to the image imagecolortransparent($pic8bit,imagecolorat($pic8bit,1,1)); #Set the transparency on the image imagecopy($base,$pic8bit,(imagesx($base)-imagesx($pic8bit))/2+1,(imagesy($base)-imagesy($pic8bit))/2+12,0,0,imagesx($pic8bit),imagesy($pic8bit)); #copy the new image onto the background header('Content-type: image/png'); #Display the image imagepng($base); if you see the links in the comments, they pretty much show and explain all my problems Previous Comments: ------------------------------------------------------------------------ [2003-05-24 19:54:55] sniper@php.net Could you provide a short example script which shows the problem? ------------------------------------------------------------------------ [2003-05-24 13:13:03] phpman at priya dot 2y dot net while I'm at it imagecolortransparent isn't working on png24 and png32... rotate seems to be quite broken full stop http://shancel.2y.net/wicons/test.php is an example of rotate playing up (with a transparency work around in use) http://shancel.2y.net/wicons/test2.php is an example of rotate playing up, just to show it's not the transparency work around causing it... ------------------------------------------------------------------------ [2003-05-24 10:45:38] phpman at priya dot 2y dot net I've tested this with both png's and gifs.... You can rotate at 90 degree angles but not at 45's or any other for that matter For the image I'm using, the script I'm using, and an example of it in action, please visit this url http://shancel.2y.net/wicons/wind2.php I used this command line to configure the build ./configure --with-mysql --with-apxs --prefix=/usr --with-gd --enable-gd-native-ttf --with-gettex/usr/include --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/lib ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23792&edit=1

« previous php.bugs (#40365) next »