How can I get the point pixel values to an array from Tiff using C#?

1.5k Views Asked by At

I want to read the pixel values from Tiff images.

I have seen a similar question, but I still have no idea how to deal with normal Tiff images.

1

There are 1 best solutions below

2
Orace On

In the samples of the libtiff.net github repository, there is one called ReadSamples and the documentation states:

This sample shows how to read RGB value of any pixel in a TIFF image.

The library provides methods that can decode almost any TIFF image and return array of packed RGBA values for its samples (pixels). This sample shows how to use Tiff.ReadRGBAImage method to get packed sample values and Tiff.GetA/GetB/GetG/GetR to unpack individual components of an RGBA value.

The code is based on ReadRGBAImage, Tiff.GetR, Tiff.GetG and Tiff.GetB methods from the libtiff.net library.