Hello,

I am trying to resize a png file, my autograph ;-)


Good result thanks to gimp:
http://boxfly.free.fr/test/test1.jpg
Bad result with php:
http://boxfly.free.fr/test/test2.jpg

This is my PHP code to resize the autograph:

$newAuto = imagecreatetruecolor( $widthImgAu, $heightImgAu) ;
imagecolortransparent($newAuto,imagecolorat($newAuto,0,0)) ;
$imgAuto = ImageCreateFromPNG($img_auto);
imagecopyresized($newAuto, $imgAuto, 0, 0, 0, 0, $widthImgAu, $heightImgAu, $imageInfoAu[0], $imageInfoAu[1]) ;
ImagePNG($newAuto,"new_auto.png");

So I tried:
imagecopyresampled($newAuto, $imgAuto, 0, 0, 0, 0, $widthImgAu, $heightImgAu, $imageInfoAu[0], $imageInfoAu[1]) ;
Instead of imagecopyresized...

To copy the autograph inside the photo I do:
$newImg = ImageCreateFromJPEG($img_des);
ImageAlphaBlending($newImg, true);
ImageCopy($newImg, $newAuto, $posX, $posY, 0, 0, $widthImgAu, $heightImgAu);

But with no sucess

If I do not resize the png autograph and copy it directly inside the photo, that's perfect, as a result the problem is the resizing...

What do I have to do to resize a png image without loosing transparency ?

Thanks.


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

Reply via email to