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
 How to split one IEBitmap into two IEBitmaps

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
mmehlfeldt Posted - Jul 09 2015 : 09:22:12
Hi,

I am looking for a performant way to split one IEBitmap into two IEBitmaps using a Mask/AlphaChannel and a negative of the Mask/AlphaChannel:
AImageEnVectMaskP.IEBitmap.Width := ASourceImage.Width;
AImageEnVectMaskP.IEBitmap.Height := ASourceImage.Height; 
AImageEnVectMaskP.Proc.Random(0.8, 0.1);
AImageEnVectMaskP.Proc.ConvertToBWOrdered;
AImageEnVectMaskP.IEBitmap.PixelFormat := ie1g;

AImageEnVectMaskN.IEBitmap.Width := AImageEnVectMaskP.IEBitmap.Width;
AImageEnVectMaskN.IEBitmap.Height := AImageEnVectMaskP.IEBitmap.Height;
AImageEnVectMaskN.IEBitmap.AssignImage(AImageEnVectMaskP.IEBitmap);
AImageEnVectMaskN.Proc.Negative;
 
{
???
ASourceImage --> ADestImageP (only pixels using positive mask)
             --> ADestImageN (only pixels using negative mask)
}


Please help me, I cant't find the the matching methods :-(

Thanks in advance,
Marc
6   L A T E S T    R E P L I E S    (Newest First)
mmehlfeldt Posted - Aug 11 2015 : 01:30:36
Hello Nigel,

it works well now, thank you!

Kind regards,
Marc
xequte Posted - Aug 05 2015 : 00:32:29
Hi Marc

Here is an example of setting the alpha channel using a source bitmap:

// Assign an alpha channel to an image using a source file (which is a monochrome bitmap where the black pixels will become transparent)

aBMP := TIEBitmap.create( 'D:\alpha.bmp' );

// Range of values in image must be 0 to 255
aBMP.PixelFormat := ie8g;

// Size of alpha channel must match size of image
aBMP.Resample( ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height );

// Use our bitmap as the alpha channel
ImageEnView1.IEBitmap.AlphaChannel.Assign( aBMP );

// Advise that the Alpha channel has value range
ImageEnView1.IEBitmap.AlphaChannel.Full := False;

// Update the container
ImageEnView1.Update;

aBMP.free;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
mmehlfeldt Posted - Jul 28 2015 : 09:47:13
Still strange results when applying a 1 bpp ieBitmap as alpha channel to a 4 bpp ieBitmap


Hi Nigel,

i still have some problems finding the right methods to apply a alpha channel to a bitmap. The alpha channel image loaded as ieBitmap from file is shown perfect. But after assigning it to an alpha channel of another image (same dimensions) the alpha channel seems to be rotated and recalculated and is now grayscale instead of black/white.
Please send me a short example code to show me how things work. Thank you!

Kind regards, Marc
xequte Posted - Jul 23 2015 : 05:52:11
Hi

Sorry I'm not entirely following your requirements, but essentially ImageEn supports both 1bit and 8bit masks, so you should have no trouble assigning an image to a mask (or creating one randomly by setting myIEMask.SetPixel() for example). To get a negative you can assign it to a another TIEMask and then call myIEMask.Negative().

If that is not what you are looking for, please explain in what way it is failing.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
mmehlfeldt Posted - Jul 21 2015 : 09:31:51
Hi Nigel,

thanks a lot for your help. Unfortunately I cannot find the right methods for a solution. The source files are Windows BMP with 4 colors (4 BPP). The merging of the assigned 1 bit alpha channels to the source file have not the result I need. I suppose because of wrong pixel formats?

Attached you will find a zipped pdf showing what I want to do in the Photoshop way.

Please tell me the fast way using ImageEN :)

attach/mmehlfeldt/201572193133_Merging1bitAlphaChannelsTo4BppImage.zip
129.37 KB
xequte Posted - Jul 09 2015 : 17:11:15
Hi Marc

IEBitmap offers a CopyToTIEMask method that will accept your 1bit image.

Likewise if you assign an IEBitmap to an alpha channel. For a 1bit image the black pixels will be fully opaque and the white ones fully transparent.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com