forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PNG transparency

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Norm.Campbell



Joined: 31 Aug 2007
Posts: 65

PostPosted: Mon Oct 10, 2022 5:16 am    Post subject: PNG transparency Reply with quote

Is it possible to add a transparency layer when creating PNG files?

Norm Campbell
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7879
Location: Salford, UK

PostPosted: Mon Oct 10, 2022 8:49 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Norm.Campbell



Joined: 31 Aug 2007
Posts: 65

PostPosted: Mon Oct 10, 2022 9:38 am    Post subject: PNG transparency Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7879
Location: Salford, UK

PostPosted: Mon Oct 10, 2022 10:22 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Norm.Campbell



Joined: 31 Aug 2007
Posts: 65

PostPosted: Mon Oct 10, 2022 11:28 am    Post subject: PNG transparency Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7879
Location: Salford, UK

PostPosted: Mon Oct 10, 2022 11:59 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Norm.Campbell



Joined: 31 Aug 2007
Posts: 65

PostPosted: Mon Oct 10, 2022 12:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group