简体   繁体   中英

What is the equivalent function for pixelgrabber (Java) in C#

I want to grab all pixel values of a Bitmap image in C# and push it into a two-dimensional array. In Java, it's easy to do with the pixelgrabber function.

What is the equivalent function to pixelgrabber (Java) in C#?

It's GetPixel .

BitmapImage image;
image.GetPixel (0, 0);

This will work, but it's not meant for parsing the whole image (it might be slow). You need to get into unmanaged code and get a pointer to the raw data if you want the performance. A sample is in Using the LockBits method to access image data .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM