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
 masking out parts of an image

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
tcardinal Posted - May 25 2012 : 09:28:29
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
2   L A T E S T    R E P L I E S    (Newest First)
tcardinal Posted - May 29 2012 : 01:51:31
Thanks, I'll give it a go
fab Posted - May 28 2012 : 14:41:31
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.