Platforms to show: All Mac Windows Linux Cross-Platform
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/Huge Tiff
This example is the version from Wed, 8th Jan 2019.
Project "Huge Tiff.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
Write
read
End EventHandler
Sub read()
// read big tiff row by row
dim t as TiffPictureMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("test.tif")
if f<>Nil then
t=new TiffPictureMBS
if t.Open(f) then
dim row as MemoryBlock
dim h as integer=t.Height-1
for i as integer=0 to h
row=t.Scanline(i)
next
t.Close
MsgBox "Read TIFF file."
end if
end if
End Sub
Sub write()
// write big tiff row by row
' const x = 20000 // 1.2 GB
const x = 30000 // 2.7 GB
dim f as FolderItem
dim t as TiffPictureMBS
f=SpecialFolder.Desktop.Child("test.tif")
if f<>Nil then
t=new TiffPictureMBS
if x > 30000 then
// big tiff
if not t.open(f, "w8") then
MsgBox "Failed to create file. Check path and write permissions."
end if
else
// normal tiff
if not t.Create(f) then
MsgBox "Failed to create file. Check path and write permissions."
end if
end if
const PLANARCONFIG_CONTIG=1
const PHOTOMETRIC_RGB=2
const FILLORDER_MSB2LSB=1
const RESUNIT_INCH=2
const ORIENTATION_TOPLEFT=1
const COMPRESSION_NONE=1
t.Height=x
t.Width=x
t.RowsPerStrip=1
t.PlanarConfig=PLANARCONFIG_CONTIG
t.Photometric=PHOTOMETRIC_RGB
t.BitsPerSample=8
t.SamplesPerPixel=3
t.FillOrder=FILLORDER_MSB2LSB
t.Orientation=ORIENTATION_TOPLEFT
t.ResolutionUnit=RESUNIT_INCH
t.VerticalResolution=72.0
t.HorizontalResolution=72.0
t.Compression=COMPRESSION_NONE
dim row as MemoryBlock = NewMemoryBlock(t.Width * 3)
dim h as integer=t.Height-1
for i as integer=0 to h
t.Scanline(i)=row
next
t.Close
MsgBox "Wrote TIFF file."
end if
End Sub
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
End Project
The items on this page are in the following plugins: MBS Images Plugin.