Can C# read geoTiff file?

  • Thread starter Thread starter FrankMeng
  • Start date Start date
F

FrankMeng

When I tried

pictureBox1.Image = Image.FromFile("aGeoTiffFile.tif");

I got an error:
System.Exception: A Graphics object cannot be created from an image
that has an indexed pixel format.

Can I load geoTiff file and access its meta info with C#?
 
TIF supports a lot of random meta data that may or may not be
supported. If all you care about is the image itself, you should run
your images through a batch converter that supports that particular
variety of TIF and convert them to something more standard like PNG.
Otherwise you'll have to use a third party library built for such.
I've used ImageMagick before and liked it, though it may not support
all strange TIF data either. I would assume the defaykt C# library
would struggle with nonstandard indexing schemes as well as 16bit
channels. My guess is that they would handle an 8bit indexed TIF but
not a 12bit indexed TIF, etc.
 
System.Exception: A Graphics object cannot be created from an image
that has an indexed pixel format.

Not supported with System.Drawing.Imaging(i.e., .Net 1.1, 2.0 )

It is supported by System.Media.Imaging(i.e., .Net 3.0 )
 
Back
Top