Search code examples
c#tiffgeotiff

Read TIFF-File Header in C#


I'd like to know the size of a tiff-picture represented by an Image. This Information can be calculated from ImageWidth and ImageLength by using ResolutionUnit and X/Y-Resolution as Parameters. However I'm not capable to extract These Information out of a tiff-picture.

The description off the tiff-file-Header is found at Adobe.

As files can easily reach sizes above 400mb such as big maps, I'm looking for a way to only scan the Header of a TIFF-File to receive basic meta data like Resolution, ResolutionUnit, ResolutionX, ResolutionY and so on...

Do you know a good way to extract these information?


Solution

  • TiffBitmapDecoder class' CodecInfo property may give you what you want.

    http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.tiffbitmapdecoder%28v=vs.110%29.aspx