Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Images/Tiff/Tiff Write Gray Test
Function:
Required plugins for this example: MBS Images Plugin, MBS Main Plugin, MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/Tiff/Tiff Write Gray Test
This example is the version from Wed, 19th Feb 2013.
Project "Tiff Write Gray Test.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() dim logo as Picture = LogoMBS(500) logo = logo.GrayScaleMBS(1) WriteTiff logo, 0, 0 // defaults WriteTiff logo, 8, TiffPictureMBS.kPhotometricMinIsWhite WriteTiff logo, 16, TiffPictureMBS.kPhotometricMinIsWhite WriteTiff logo, 8, TiffPictureMBS.kPhotometricMinIsBlack WriteTiff logo, 16, TiffPictureMBS.kPhotometricMinIsBlack AutoQuit = true End EventHandler
Sub WriteTiff(pic as Picture, Bits as integer, Photometric as integer) dim f as FolderItem dim t as TiffPictureMBS dim bitsString as string Select case bits case 8 bitsString = "8 Bit" case 16 bitsString = "16 Bit" case 0 bitsString = "default" else break end Select dim PhotometricString as string Select case Photometric case TiffPictureMBS.kPhotometricMinIsBlack PhotometricString = "MinIsBlack" case TiffPictureMBS.kPhotometricMinIsWhite PhotometricString = "MinIsWhite" case 0 PhotometricString = "default" else break end Select dim name as string = "test "+bitsString+" "+PhotometricString+".tiff" System.DebugLog name f = SpecialFolder.Desktop.Child(name) if f<>Nil then t=new TiffPictureMBS if t.Create(f) then t.Pict=pic if Photometric<>0 then t.Photometric = Photometric end if if bits<>0 then t.BitsPerSample = bits end if if t.WriteGray then // ok else break MsgBox "Failed to write tiff file "+f.Name end if t.Close end if 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

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Images Plugin.




Links
MBS Xojo PDF Plugins