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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Transparent 32-bit PNG
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

kbriggs

USA
2 Posts

Posted - Sep 24 2013 :  19:29:22  Show Profile  Reply
I've got an old (version 3.0.5) license of ImageEn. I cannot figure out how to create a 32-bit transparent PNG image. This is my code:

ie := TImageEnView.Create(nil);
ie.EnableAlphaChannel := True;
ie.IO.IEBitmap.Width := 100;
ie.IO.IEBitmap.Height := 100;
ie.LegacyBitmap := False;
ie.IO.IEBitmap.PixelFormat := ie32RGB;
ie.IO.Params.BitsPerSample := 8;
ie.IO.Params.SamplesPerPixel := 4;
ie.IO.SaveToFilePNG('C:\Temp\test.png');
ie.Free;

The result is a 24-bit, 3 SamplesPerPixel image with a white background, not a 32-bit, 4 SamplesPerPixel image as desired. What am I doing wrong here?

w2m

USA
1990 Posts

Posted - Sep 25 2013 :  08:46:07  Show Profile  Reply
I do not think you should set ie.IO.IEBitmap.PixelFormat := ie32RGB.

This is what I do to create a 32-bit transparent bitmap or png:
ImageEnView.IO.Params.BitsPerSample := 8;
ImageEnView.IO.Params.SamplesPerPixel := 4;
iRGB := ImageEnView.IEBitmap.Pixels[0, ImageEnView.IEBitmap.Height - 1];
ImageEnView.Proc.SetTransparentColors(iRGB, iRGB, 0);

Hope this helps.
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

kbriggs

USA
2 Posts

Posted - Sep 25 2013 :  12:10:30  Show Profile  Reply
William,

That worked. Thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: