Home  |  Linux  | Mysql  | PHP  | XML
From:Albert Rovira Date:Fri Jun 13 10:10:02 2008
Subject:Problem with image transparency and gdImageCopyResampled
Hi,

I need to load a .gif image and save as resized truecolor .png image.
I wrote this code:


gdImage srcimage = gdscript.gdImageCreateFromGifPtr(out.toByteArray());

gdImage aux  = gdscript.gdImageCreateTrueColor(targetWidth,targetHeight);
 
gdscript.gdImageCopyResampled(aux,srcimage,0,0,0,0,aux.getSx(),aux.getSy(),srcimage.getSx(),srcimage.getSy());

String name = System.currentTimeMillis() +".png";
byte[] png = gdscript.gdImagePngBuf(srcimage);
FileOutputStream out = new FileOutputStream(name);
out.write(png);
out.close();


But destination image lost transparency of the original image (it has 
black background). Any method to mantain the transparency ? Can 
dImageAlphaBlending() help me ? (Seem that only work with draw functions 
not with copy image functions).


Thanks,
Albert.



Navigate in group php.gd.devel at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants