Reputation: 942
private static int GetCompressionType(Image image)
{
// The zero-based index of the first occurrence within the entire array, if found; otherwise, –1.
int compressionTagIndex = Array.IndexOf(image.PropertyIdList, 0x103);
PropertyItem compressionTag = image.PropertyItems[compressionTagIndex];
return BitConverter.ToInt16(compressionTag.Value, 0);
}
Hello Programers. I wrote a program where i can rotate an Image (any kind of image) based on User input. Concern is when I rotate the tiff image, its actually rotate as per user input but i loose the compression, so used the above method (googled it).. And now I have some doubts on this..
Upvotes: 2
Views: 977
Reputation: 49189
The TIFF file format is also known as Tagged Image File Format. There are collections of tags and values that describe the image and how it is stored within the file.
In this case, there is a tag which describes the image compression, which happens to be tag value 0x103. Now, that's just the tag. The value describes the actual compression type, the most common of which are:
Upvotes: 5