Get Image Compression

Example requests & Code samples for GdPicture Toolkits.
Post Reply
jstark
Posts: 17
Joined: Wed Apr 02, 2008 5:53 pm

Get Image Compression

Post by jstark » Mon Sep 29, 2008 4:59 pm

I am loading a tiff from my hard drive into the Imaging object. I need to find out what compression was used to save the image. Is there a property for this infomation?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Get Image Compression

Post by Loïc » Thu Nov 13, 2008 6:35 pm

A solution consist to retrieve the Compression tag of the native image:

Code: Select all

Imaging1.DisableGdimgplugCodecs (True)
Imaging1.CreateImageFromFile ("image.tif")

For i = 1 To Imaging1.ExifTagCount
    If Imaging1.ExifTagGetID(i) = Tags.TagCompression Then
       Select Case Trim(Imaging1.ExifTagGetValueString(i))
              Case "1"
                   MsgBox "No compression"
              Case "3"
                   MsgBox "CCITT3"
              Case "4"
                   MsgBox "CCITT4"
              Case "5"
                   MsgBox "LZW"
              Case "32773"
                   MsgBox "RLE"
              Case Else
                   MsgBox "Unknown " & Imaging1.ExifTagGetValueString(i)
       End Select
    End If
Next i
Best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests