ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 8 bits png with transparent color

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
nwscomps Posted - Mar 01 2012 : 17:30:21
I know that I can save a 32bits png but it would be nice to have the transparent color support for 8 bits png like it is for Gif. Will it be implemented? Thank you.

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
4   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Mar 04 2012 : 12:45:51
You can modify the alpha channel so that a color (or a range of colors) becomes transparent using SetTransparentColors. For example this will make all colors from 0,0,0 (black) up to 128,128,128 (gray) transparent:

ImageEnView1.Proc.SetTransparentColors(CreateRGB(0,0,0), CreateRGB(100,100,100), 0);
ImageEnView1.IO.Params.BitsPerSample := 8;
ImageEnView1.IO.Params.SamplesPerPixel := 1;
ImageEnView1.IO.SaveToFile('test.png');

A field like GIF_TranspColor is not currently planned for PNG.
nwscomps Posted - Mar 04 2012 : 12:17:23
Hi Fabrizio, thanks for your answer, this will save a 8bits png with alpha channel (which is a good alternative) but I was looking for the equivalent of Gif's transparent color. In gif you can set a color to be transparent so that you can simulate the effect of a transparent background. Is there any way to do that with png?

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
fab Posted - Mar 03 2012 : 14:53:36
Hi Francesco, sorry for the delay.
In order to save a PNG with 8 bits per pixel (with palette) and alpha channel you have to set BitsPerSample=8 and SamplesPerPixel=1, for example:

ImageEnView1.IO.Params.BitsPerSample := 8;
ImageEnView1.IO.Params.SamplesPerPixel := 1;
ImageEnView1.IO.SaveToFile('output.png');

Please note that previous versions (< 4.1) cannot load alpha channel from 8bpp PNGs, while saving is supported.
nwscomps Posted - Mar 03 2012 : 11:36:29
Sorry did I ask something too hard to answer? I hope to get a response :)

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library