Platforms to show: All Mac Windows Linux Cross-Platform
/GraphicsMagick/ImageMagick7/ImageMagick 7 Test
Required plugins for this example: MBS GraphicsMagick Plugin, MBS Main Plugin
Last modified Thu, 26th Feb 2025.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /GraphicsMagick/ImageMagick7/ImageMagick 7 Test
Download this example: ImageMagick 7 Test.zip
Project "ImageMagick 7 Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// you may need to set path to coders if not in registry on Windows
'System.EnvironmentVariable("MAGICK_CODER_MODULE_PATH") = "C:\Program Files (x86)\ImageMagick-7.1.1-Q16-HDRI\modules\coders"
#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
'i.Filename = f.URLPath
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
Sign
End Sign
End Project
See also:
Download this example: ImageMagick 7 Test.zip
The items on this page are in the following plugins: MBS GraphicsMagick Plugin.