I have an indexed Tiff image which I'm reading using LibTiff.Net to produce a bitmap image of a section of the large image. I believe the Tiff will have 256 colour entries which I want to convert to 256 32-bit pixel values to be used in the output bitmap.
int bitsPerSample = tif.GetField(TiffTag.BITSPERSAMPLE)[0].ToInt();
FieldValue[] colourIndex = tif.GetField(TiffTag.COLORMAP);
int[] palette = new int[256];
for( int i = 0; i < 256; i++ )
{
short red = colourIndex[0].ToShortArray()[i];
short green = colourIndex[1].ToShortArray()[i];
short blue = colourIndex[2].ToShortArray()[i];
palette[i] = ?
}
How do I convert the RGB shorts into a 32-bit pixel value?