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 |