Image Averaging in C#

I'm writing a C# script in Grasshopper to perform image averaging. The goal is to analyze the color gradient of an architectural plan and apply transformations (TBD) to produce different effects.

Although Grasshopper has an image sampler component, I wanted to code one myself but am facing difficulties in assigning a Type Hint to the C# input - there is no Image option. Does anyone have suggestions? Thanks!

I think the problem here is one of inheritance. Image is the more generic type, while Bitmap derives from Image. Images can be WMF and EMF files as well, and those are vector based formats. Bitmaps deal strictly with pixels.

The FromFile method is actually defined on Image, not Bitmap, and as such it returns an Image type. Since an Image doesn't know anything about pixels, it doesn't provide the GetPixel/SetPixel functionality.

Yes, that was the case. I got it to work with bitmap type. I still find it weird that the image type doesn't have a way to access the data (raw or not). I could be wrong but it's definitively not obvious on the ms msdn class webpage.