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
 IEvolution Get Pixel Color

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
cyberfly Posted - Aug 24 2022 : 20:51:44
I am trying to get the RGB values of a pixel. I know I have to use GetPixel to get it but it is not clear how it is used. Is there an example using GetPixel to get an RGB value?

I have the following code but I don't know what the 3rd parameter "color" is supposed to be.

private void ieViewer1_MouseMove(object sender, MouseEventArgs e)
{
int PixelXpos = ieViewer1.XClientToBitmap(e.X);
int PixelYpos = ieViewer1.YClientToBitmap(e.Y);
Color ColorOfPixel;
ColorOfPixel = ieViewer1.Image.GetPixel(PixelXpos, PixelYpos, Color);
}


Kevin Cary-Grimm
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 28 2022 : 00:20:50
Nice one, Kevin

Nigel
Xequte Software
www.imageen.com
cyberfly Posted - Aug 26 2022 : 18:35:29
I've got it now. This is actually what works. The PixRGB variable must be initialized and passed by reference.

IERGBA PixRGBA;
PixRGBA.r = 0;
PixRGBA.b = 0;
PixRGBA.g = 0;
PixRGBA.a = 0;
ieViewer1.Image.GetPixel(PixelXpos, PixelYpos, ref PixRGBA);

Kevin Cary-Grimm
cyberfly Posted - Aug 24 2022 : 22:19:45
I am getting an invalid parameter error in C# for "PixRGBA".

IERGBA PixRGBA;
ieViewer1.Image.GetPixel(PixelXpos, PixelYpos, PixRGBA);

Kevin Cary-Grimm
cyberfly Posted - Aug 24 2022 : 21:54:26
Thank you so much for the help.

Kevin Cary-Grimm
xequte Posted - Aug 24 2022 : 21:49:54
Hi Kevin

You should use the IERGBA overload:

https://www.imageen.com/ievolutionhelp/html/1f36614a-2892-e825-2837-2ef4a3ad078b.htm

Which will make it much simpler.


int PixelXpos = ieViewer1.XClientToBitmap(e.X);
int PixelYpos = ieViewer1.YClientToBitmap(e.Y);
IERGBA PixRGBA;
ieViewer1.Image.GetPixel(PixelXpos, PixelYpos, PixRGBA);

...Do something with PixRGBA.r... PixRGBA.g... PixRGBA.g...


Nigel
Xequte Software
www.imageen.com