Problem with image transparency and gdImageCopyResampled
[email protected] (Albert Rovira) Fri, 13 Jun 2008 18:10:02 +0200
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
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.