Re: [GD-DEVEL] Problem with transparency
[email protected] (Brian Peschel) Fri, 26 Sep 2008 13:36:20 -0500
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
The mail list won't let me send attachments. Any other ideas how I can get the files to you guys to look at? - Brian > Brian Peschel wrote: >> Looks like the mailing list didn't like my attachments. Let me try >> again..... >> >> - Brian >> >> Brian Peschel wrote: >>> Pierre Joye wrote: >>>> That means: >>>> >>>> gif has a transparent color (background color), the color index is 3 >>>> All other has no transparent color (expected for JPEG, not sure if XPM >>>> supports a background color). It could be the reason why the copy does >>>> not work as you expect. However it would help if you show us the >>>> source and destination images (per format), it will help to understand >>>> exactly what you like to achieve (and what happens now with >>>> xpm/jpeg/png). >>>> >>>> Cheers, >>>> >>> >>> Okay, I poked around a bit more. It appears my JPG image did not >>> have transparency set correctly, hence it not working. And it looks >>> like I can get it working with the PNG file also. From what I can >>> find on the web, setting a color in the XPM to 'None' will cause >>> transparency (which does work in X using a >>> XpmCreatePixmapFromData(), XSetClipMask(), XSetClipOrigin(), and >>> XCopyArea() combination). In other words the line: >>> "0 c None" >>> means transparent. >>> >>> So, I took the tiling example at http://www.libgd.org/CopyResize and >>> tweaked it a bit to match my usage (hopefully my attachments come >>> through), see plotTest3.C. I ran this with the four sample images >>> (small.*). >>> plotTest3 small.gif ; mv tiled.jpg tiled.gif.jpg >>> small.gif Width 8 height 8 transparent 1 >>> >>> plotTest3 small.jpg ; mv tiled.jpg tiled.jpg.jpg >>> small.jpg Width 8 height 8 transparent -1 >>> >>> plotTest3 small.png ; mv tiled.jpg tiled.png.jpg >>> small.png Width 8 height 8 transparent -1 >>> >>> plotTest3 small.xpm ; mv tiled.jpg tiled.xpm.jpg >>> small.xpm Width 8 height 8 transparent -1 >>> >>> The gdImageGetTransparent() result only shows a value for the GIF, >>> not for the other 3. However, the PNG did work (tiled.*.jpg). >>> >>> So, I have it working for GIF and PNG. It isn't working for JPG >>> (but I am fairly confident it it the source file). It doesn't work >>> with XPM. Do I assume that it not working for XPM is a GD issue >>> based on Pierre's comments above? >>> >>> Thanks! >>> >>> - Brian >>> >>