You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/JPEG/StringToJPEG Example
Class LoadWindow Inherits Window
EventHandler Sub DropObject(obj As DragItem, action As Integer)
do
if obj.folderItemavailable then
load obj.folderItem
end if
loop until not obj.nextItem
End EventHandler
EventHandler Sub Open()
me.acceptFileDrop "image/jpeg"
End EventHandler
Sub load(f as folderItem)
dim s as string
dim b as binaryStream
dim j as JPEGImporterMBS
// Read data from file into string
b=f.openasbinaryFile(false)
if b<>nil then
s=b.read(b.length)
b.close
// Make a picture...
j=new JPEGImporterMBS
j.Data=s
j.AllowDamaged=true
j.Import
backdrop=j.Picture
title=f.displayName+": "+str(j.Width)+" x "+str(j.Height)+" with "+str(j.CurrentDepth)+" bits"
end if
End Sub
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