9

Is there any sane way to work with bitmaps in WPF? I'd like similar functionality as System.Drawing.Bitmap: be able to load image from file and get and set the color of particular pixels.

I know about WriteableBitmap, but I don't want to work with Arrays of gods-know-what (I couldn't find that on MSDN), or pointers. I just want to read or write pixel, it shouldn't be that hard!

I also know that I can use Interop to work with System.Drawing.Bitmap in WPF, but that's not nice either.

Community
  • 1
  • 1
svick
  • 236,525
  • 50
  • 385
  • 514
  • Does this answer your question? [Finding specific pixel colors of a BitmapImage](https://stackoverflow.com/questions/1176910/finding-specific-pixel-colors-of-a-bitmapimage) – Peter Duniho Jun 26 '21 at 19:55

1 Answers1

10

Here's something on how to do get pixel info from a System.Windows.Media.Imaging.BitmapImage.

Although, if you'd prefer to work with a System.Drawing.Bitmap you might want to add a reference to System.Drawing.dll and use it instead.

Here's a somewhat-related forum post on image manipulation in WPF.

Community
  • 1
  • 1
IV.
  • 1,213
  • 1
  • 14
  • 14