You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/JPEG/LoadAsJPEG Example
Class Window1 Inherits Window
Control res Inherits Label
ControlInstance res Inherits Label
End Control
Control err Inherits Label
ControlInstance err Inherits Label
End Control
EventHandler Sub DropObject(obj As DragItem, action As Integer)
dim p as picture
dim j as JPEGImporterMBS
dim s as String
do
if obj.folderItemavailable then
j=new JPEGImporterMBS
j.file=obj.folderItem
j.Import
err.text=j.ErrorMessage
backdrop=j.Picture
Title=j.File.DisplayName+": "+str(j.Width)+" x "+str(j.Height)+" @ "+str(j.CurrentDepth)+" bits" // <-- CONVERTED
select case j.ResolutionUnit
case 0
s=" dots/?"
case 1
s=" dots/inch"
case 2
s=" dots/cm"
end Select
res.text=str(j.HorizontalResolution)+" x "+str(j.VerticalResolution)+s
end if
loop until not obj.nextItem
End EventHandler
EventHandler Sub Open()
me.acceptfileDrop "image/jpeg"
End EventHandler
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class