Hi all,
I use following script to generate a resized png image on the fly.  I tried
for several hours and found that it
not works for every png image. And finally i found that the
imagecreatfrompng() only works for 24bits png.
i.e my script does not works on my abc.png which is 8bpp(bitsperpixel),
after i increased it;s color depth to 24bits,
it works perfectly. Is it true that the png function only works on 24bpp png
image? (i'm not sure...)

Or put it on this way, how can i increase the color depth in php before
process following script?

I use apache 2.x on win2k, php4.2.2 with php_gd.dll enabled.


<?php
$image = imagecreatefrompng("abc.png");
$newimage = imagecreate(300, 300);

$black = imagecolorallocate($newimage, 0,0,0);

imagecopyresized($newimage, $image, 0, 0, 0, 0, 300, 300, 400, 300);

imagedestroy($image);
imagestring($newimage, 2, 10, 10, "Copyright 2001", $black);

header("Content-type: image/png");
imagepng($newimage);
imagedestroy($newimage);

?>

Thanks in advance.
NoWhErEMaN



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to