View previous topic :: View next topic |
Author |
Message |
Norm.Campbell
Joined: 31 Aug 2007 Posts: 66
|
Posted: Mon Oct 10, 2022 5:16 am Post subject: PNG transparency |
|
|
Is it possible to add a transparency layer when creating PNG files?
Norm Campbell |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8012 Location: Salford, UK
|
Posted: Mon Oct 10, 2022 8:49 am Post subject: |
|
|
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". |
|
Back to top |
|
|
Norm.Campbell
Joined: 31 Aug 2007 Posts: 66
|
Posted: Mon Oct 10, 2022 9:38 am Post subject: PNG transparency |
|
|
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. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8012 Location: Salford, UK
|
Posted: Mon Oct 10, 2022 10:22 am Post subject: |
|
|
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. |
|
Back to top |
|
|
Norm.Campbell
Joined: 31 Aug 2007 Posts: 66
|
Posted: Mon Oct 10, 2022 11:28 am Post subject: PNG transparency |
|
|
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. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8012 Location: Salford, UK
|
Posted: Mon Oct 10, 2022 11:59 am Post subject: |
|
|
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. |
|
Back to top |
|
|
Norm.Campbell
Joined: 31 Aug 2007 Posts: 66
|
Posted: Mon Oct 10, 2022 12:59 pm Post subject: |
|
|
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). |
|
Back to top |
|
|
|