Is it possible to add a transparency layer when creating PNG files?
Norm Campbell
Welcome to our forums
Is it possible to add a transparency layer when creating PNG files?
Norm Campbell
Try seaching Google for 'png with transparent background'.
If you are programming a ClearWin+ application that exports a png file then perhaps you need to add opacity to the image. Try searching in ftn95.chm for 'opacity'.
I should have been more explicit.
Currently I have a work-around, where I load the JPG images into Photoshop; define a 'transparent' area; and export the resulting edited images as PNGs.
This has been fine for the occasional PNG file, but now I'm looking at quite a number of yield map images with non-rectangular boundaries, all of which need editing.
What I'd like to be able to do is use something like PUT_DIB_BLOCK (which I use now to write my JPGs) to write a 24-bit PNG file, where the 4th byte is the transparency layer.
PUT_DIB_BLOCK@ can currently be used to export bmp or jpeg files but not png files.
In theory it could be extended to png files but off hand I don't know how big a task that would be.
EXPORT_IMAGE@ can be used with png files so that provides a possible alternative.
I read that PUT_DIB_BLOCK worked for PNG files, so I changed the extension, and my code wrote a PNG file.
The resulting PNG file (according to its properties) is 24-bit, and displays when I click on it.
It opens in Paint, but not in Photoshop CS4.
I can't see any evidence in the documentation or the code to suggest that PUT_DIB_BLOCK@ supports png files.
I am guessing that the output is the same as for a bmp file and that some applications can tell the difference.
You guessed correctly.
My code only appears to write a PNG file because I gave the file name a PNG extension.
When I renamed the output 'PNG' file as .BMP, CS4 recognised it (as did Paint).