Platforms to show: All Mac Windows Linux Cross-Platform
/Images/Tiff/TIFF Picture Info
Required plugins for this example: MBS Images Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/Tiff/TIFF Picture Info
This example is the version from Wed, 16th Dec 2014.
Project "TIFF Picture Info.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub OpenDocument(item As FolderItem)
MainWindow.load item
End EventHandler
End Class
Class MainWindow Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim f as FolderItem
f=GetOpenFolderItem(MyFileTypes.ImageTiff)
if f<>Nil then
load f
end if
End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
if t.ReadRGB then
dim p as Picture
p=t.CombinePictureWithMask
if p=nil then
MsgBox "Failed to get a picture."
else
dim w as new PictureWindow
w.Backdrop=p
w.Show
end if
else
MsgBox "Failed to read this picture."
end if
End EventHandler
End Control
Sub load(f as FolderItem)
dim x as integer
dim s as string
list.DeleteAllRows
t=new myTiffPictureMBS
if t.Open(f) then
List.AddRow "File: "+f.DisplayName
List.AddRow "BitsPerSample: "+str(t.BitsPerSample)
List.AddRow "BytesPerRow: "+str(t.BytesPerRow)
x=t.Compression
select case x
case 1
s="dump mode"
case 2
s="CCITT modified Huffman RLE"
case 3
s="CCITT Group 3 fax encoding"
case 4
s="CCITT Group 4 fax encoding"
case 5
s="Lempel-Ziv & Welch"
case 6
s="!6.0 JPEG"
case 7
s="%JPEG DCT compression"
case 8
s="Deflate compression, as recognized by Adobe"
case 32766
s="NeXT 2-bit RLE"
case 32771
s="#1 w/ word alignment"
case 32773
s="Macintosh RLE"
case 32809
s="ThunderScan RLE"
case 32895
s="IT8 CT w/padding"
case 32896
s="IT8 Linework RLE"
case 32897
s="IT8 Monochrome picture"
case 32898
s="IT8 Binary line art"
case 32908
s="Pixar companded 10bit LZW"
case 32909
s="Pixar companded 11bit ZIP"
case 32946
s="Deflate compression"
case 32947
s="Kodak DCS encoding"
case 34661
s="ISO JBIG"
case 34676
s="SGI Log Luminance RLE"
case 34677
s="SGI Log 24-bit packed"
else
s=""
end Select
List.AddRow "Compression: "+str(x)+" "+s
List.AddRow "Copyright: "+(t.Copyright)
List.AddRow "DateTime: "+(t.DateTime)
List.AddRow "DocumentName: "+(t.DocumentName)
dim m as MemoryBlock = t.ExtraSamples
if m<>Nil then
List.AddRow "ExtraSamples: "+str(m.size/2)
for i as integer = 0 to m.size-1 step 2
x = m.Int16Value(i)
Select case x
case 0
s="unspecified data"
case 1
s="associated alpha data"
case 2
s="unassociated alpha data"
else
s=""
end Select
List.AddRow "ExtraSample "+str(i+1)+": "+str(x)+" "+s
next
end if
x=t.FillOrder
Select case x
case 1
s="Most significant bit to Least significant bit"
case 2
s="Least significant bit to Most significant bit"
else
s=""
end Select
List.AddRow "FillOrder: "+str(x)+" "+s
List.AddRow "Height: "+str(t.Height)
List.AddRow "HorizontalPosition : "+str(t.HorizontalPosition )
List.AddRow "HorizontalResolution: "+str(t.HorizontalResolution)
List.AddRow "HostComputer: "+(t.HostComputer)
List.AddRow "ImageDescription: "+(t.ImageDescription)
List.AddRow "Make: "+(t.Make)
List.AddRow "Model: "+(t.Model)
x=t.Orientation
select case x
case 1 //* row 0 top, col 0 lhs */
s="top left"
case 2 //* row 0 top, col 0 rhs */
s="top right"
case 3 //* row 0 bottom, col 0 rhs */
s="bottom right"
case 4 //* row 0 bottom, col 0 lhs */
s="bottom left"
case 5 //* row 0 lhs, col 0 top */
s="top left"
case 6 //* row 0 rhs, col 0 top */
s="top right"
case 7 //* row 0 rhs, col 0 bottom */
s="bottom right"
case 8 //* row 0 lhs, col 0 bottom */
s="bottom left"
else
s=""
end Select
List.AddRow "Orientation: "+str(x)+" "+s
List.AddRow "PageName: "+(t.PageName)
x=t.Photometric
Select case x
case 0
s="WhiteIsZero"
case 1
s="BlackIsZero"
case 2
s="RGB"
case 3
s="Palette color"
case 4
s="Transparency mask"
case 5
s="Separation"
case 6
s="YCBCR"
case 8
s="1976 CIE L*a*b*"
case 9
s="ICC L*a*b* [Adobe TIFF Technote 4]"
case 10
s="ITU L*a*b*"
case 32844
s="CIE Log2(L)"
case 32845
s="CIE Log2(L) (u',v')"
else
s=""
end Select
List.AddRow "Photometric: "+str(x)+" "+s
List.AddRow "PlanarConfig: "+str(t.PlanarConfig)
x=t.ResolutionUnit
Select case x
case 1
s="unknown"
case 2
s="inch"
case 3
s="metric"
else
s=""
end Select
List.AddRow "ResolutionUnit: "+str(x)+" "+s
List.AddRow "RowsPerStrip: "+str(t.RowsPerStrip)
x=t.SampleFormat
Select case x
case 1
s="unsigned integer data"
case 2
s="signed integer data"
case 3
s="IEEE floating point data"
case 4
s="untyped data"
case 5
s="complex signed int"
case 6
s="complex ieee floating"
else
s=""
end Select
List.AddRow "SampleFormat: "+str(x)+" "+s
List.AddRow "SamplesPerPixel: "+str(t.SamplesPerPixel)
List.AddRow "Software: "+(t.Software)
List.AddRow "VerticalPosition: "+str(t.VerticalPosition)
List.AddRow "VerticalResolution: "+str(t.VerticalResolution)
List.AddRow "Width: "+str(t.Width)
else
MsgBox "Failed to open tiff file."
end if
End Sub
Property t As TiffPictureMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class myTiffPictureMBS Inherits TiffPictureMBS
EventHandler Sub Error(libModule as string, message as string)
MainWindow.List.AddRow "Error in "+libModule+": "+Message
End EventHandler
EventHandler Sub Warning(libModule as string, message as string)
MainWindow.List.AddRow "Warning in "+libModule+": "+Message
End EventHandler
End Class
MyFileTypes
Filetype image/tiff
End MyFileTypes
Class PictureWindow Inherits Window
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Images Plugin.