Platforms to show: All Mac Windows Linux Cross-Platform
/GraphicsMagick/ImageMagick7/ImageMagick 7 Test
Required plugins for this example: MBS Main Plugin, MBS GraphicsMagick Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /GraphicsMagick/ImageMagick7/ImageMagick 7 Test
This example is the version from Sun, 9th May 2020.
Project "ImageMagick 7 Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
#If TargetMacOS Then
Dim f As FolderItem = GetFolderItem("libMagickCore-7.Q16HDRI.7.dylib")
If ImageMagick7MBS.LoadLibraryFile(f) Then
'MsgBox "loaded"
Else
MsgBox "failed to load: "+ImageMagick7MBS.LoadErrorString
End If
#Else
If ImageMagick7MBS.LoadLibrary("CORE_RL_MagickCore_.dll") Then
'MsgBox "loaded"
Else
MsgBox "failed to load: "+ImageMagick7MBS.LoadErrorString
End If
#EndIf
Dim quantumDepth As Integer = ImageMagick7MBS.QuantumDepth
Dim quantumRange As UInt32 = ImageMagick7MBS.QuantumRange
Dim QuantumSize As Integer = ImageMagick7MBS.QuantumSize // bytes per value
Dim HDRI As Boolean = ImageMagick7MBS.HDRI
Dim Epsilon As Double = ImageMagick7MBS.Epsilon
Dim MaxColormapSize As Integer = ImageMagick7MBS.MaxColormapSize
Dim MaxMap As Integer = ImageMagick7MBS.MaxMap
Break // read in debugger
'MsgBox str(IMImage7MBS.ScaleQuantumToChar(65535.0))+" "+str(IMImage7MBS.ScaleQuantumToChar(0.0))
End EventHandler
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.jpg")
If Not f.Exists Then
break
MsgBox "test.jpg missing on desktop"
End If
Dim i As New IMImageInfo7MBS
i.Filename = f.NativePath
Dim p As IMImage7MBS = i.ReadImage
Dim l As Picture = LogoMBS(500)
call p.SetPicture(l)
Dim g As FolderItem = SpecialFolder.Desktop.Child("output.jpg")
Dim o As New IMImageInfo7MBS
o.Filename = g.NativePath
p.Filename = g.NativePath
If o.WriteImage(p) Then
'MsgBox "saved"
Else
MsgBox "failed to write output file"
End If
Backdrop = p.CopyPicture
End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS GraphicsMagick Plugin.