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
 masking out parts of an image
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

tcardinal

27 Posts

Posted - May 25 2012 :  09:28:29  Show Profile  Reply
I am sure that this is fairly straighforward but can't see it in the help file.

I have 2 images one in colour and one in black and white. I want to use the black and white image to remove parts from the colour image. Think of teh black and white image as a checker board and when applied to the colour image the colour image keeps all the parts overlayed by a black square and removes all the parts covered with a white square and replaces then with a solid colour or makes them transparent.

Thanks

Russell

fab

1310 Posts

Posted - May 28 2012 :  14:41:31  Show Profile  Reply
You can load the alpha channel from an external file (assuming it has the same width and height of current image) with:
ImageEnView1.IO.LoadFromFile('mainimage.jpg');
ImageEnView1.AlphaChannel.Read('alphachannel.jpg');
ImageEnVIew1.AlphaChannel.PixelFormat := ie8g;
ImageEnView1.Update();

Now areas with "0" in alphachannel.jpg are transparent.
If you want to fill transparent areas with a color (hence to discard alpha channel), you can execute:
// fill transparent areas with red (255,0,0)
ImageEnView1.SetAlphaRangePixelsColor(0, 0, CreateRGB(255, 0, 0));
ImageEnView1.RemoveAlphaChannel();


Hope this helps.
Go to Top of Page

tcardinal

27 Posts

Posted - May 29 2012 :  01:51:31  Show Profile  Reply
Thanks, I'll give it a go
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: