Posted before, but it got closed because I wrote it wrong. I'm trying to get the color of individual pixels in an image. I'm also trying to load the image from an external source - in this case, let's say I'm trying get a color from a 'abcd.jpg' (or png it doesn't really matter here) of dimensions 400x400px. The color I'm trying to get is of a pixel at 200x200. What I tried based on the previous answers was:
var ipath = @"abcd.jpg";
var color;
using (Image image = Image.Load(ipath))
{
color = image<TPixel>[200,200];
}
This doesn't work though, and any time I try to use TPixel or Rgba32 it just tells me that "the variable image cannot be used with type arguments" and "the type or namespace TPixel could not be found". Someone please help, I honestly don't care what format I get the color in I just need to get the color data somehow. Thanks in advance.
You needed to the load the image with a specific pixel type not use the pixel agnostic version. So you need to call the
Image.Load<Rgba32>(..)
overload(i.e. one with a pixel type specified, in this caseRgba32
)