Platforms to show: All Mac Windows Linux Cross-Platform
JPEGImporterMBS.BlueTestPicture as picture
Function:
Returns a 100x100 pixel big picture filles with RGB(0,0,255).
Notes: Just for testing how well the plugin picture code works.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 5.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Notes: Just for testing how well the plugin picture code works.
JPEGImporterMBS.CleanMarkers
Function:
Clears the marker list.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 6.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
JPEGImporterMBS.FinishJPEG
Function:
Releases all memory buffers needed for the JPEG decompression.
Notes:
This must be called if you used InitJPEG!
Else you have a memory leak.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 3.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Notes:
This must be called if you used InitJPEG!
Else you have a memory leak.
JPEGImporterMBS.GreenTestPicture as picture
Function:
Returns a 100x100 pixel big picture filles with RGB(0,255,0).
Notes: Just for testing how well the plugin picture code works.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 5.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Notes: Just for testing how well the plugin picture code works.
JPEGImporterMBS.Import
Function:
Imports the picture.
Example:
Notes:
This methods should read all JPEG files you can get, but I've only tested it for 32 bit color and 8 bit grayscale.
I wrote it mainly because Xojo's built in OpenAsJPEG code crashes badly if your picture is not full downloaded. For example if you have a webbrowser you can now show JPEGs while you download them. Normally you can see a good picture allready with 50% of the data.
Xojo's OpenAsPicture in contrast crashes if the picture is not 100% downloaded or instead of a crash you get a white picture.
This method uses the YieldTicks property and may yield time to other threads.
Depending on the mode this method can read CMYK and RGB. RGB either to memoryblock or to a picture object.
The memoryblock data must be in the format with bytes in the order RGB.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Example:
dim f as FolderItem
dim ji as new JPEGImporterMBS
dim je as new JPEGExporterMBS
dim m as MemoryBlock
dim i,c as Integer
// read jpeg
f=SpecialFolder.Desktop.Child("input.jpg")
ji.Mode=ji.ModeRGB // read RGB to memoryblock
ji.File=f
ji.Import
m=ji.PictureData
// add red
c=m.Size-1
for i=0 to c step 3
m.Byte(i)=255
next
// write jpeg
f=SpecialFolder.Desktop.Child("test.jpg")
je.File=f
je.ExportRGB(m,ji.Width, ji.Height, ji.Width*3)
This methods should read all JPEG files you can get, but I've only tested it for 32 bit color and 8 bit grayscale.
I wrote it mainly because Xojo's built in OpenAsJPEG code crashes badly if your picture is not full downloaded. For example if you have a webbrowser you can now show JPEGs while you download them. Normally you can see a good picture allready with 50% of the data.
Xojo's OpenAsPicture in contrast crashes if the picture is not 100% downloaded or instead of a crash you get a white picture.
This method uses the YieldTicks property and may yield time to other threads.
Depending on the mode this method can read CMYK and RGB. RGB either to memoryblock or to a picture object.
The memoryblock data must be in the format with bytes in the order RGB.
JPEGImporterMBS.ImportCMYK
Function:
Imports a CMYK picture.
Example:
Notes:
This methods should read all JPEG files you can get, but I've only tested it for 32 bit color and 8 bit grayscale.
The read CMYK values are stored in the picturedata property.
This method uses the YieldTicks property and may yield time to other threads.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 3.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Example:
dim g as FolderItem
dim ji as JPEGImporterMBS
dim je as JPEGExporterMBS
dim f as FolderItem
dim m as MemoryBlock
// import it
g=getOpenFolderItem("image/jpeg")
ji=new JPEGImporterMBS
ji.File=g
ji.AllowDamaged=true
ji.ImportCMYK
m=ji.PictureData
// export it
f=SpecialFolder.Desktop.child("test.jpg")
je=new JPEGExporterMBS
je.HorizontalResolution=300
je.VerticalResolution=300
je.ResolutionUnit=1
je.File=f
je.Quality=75
je.ExportCMYK m, ji.Width, ji.Height, ji.Width*4
This methods should read all JPEG files you can get, but I've only tested it for 32 bit color and 8 bit grayscale.
The read CMYK values are stored in the picturedata property.
This method uses the YieldTicks property and may yield time to other threads.
JPEGImporterMBS.InitJPEG as boolean
Function:
Initializes the JPEG decompressor for use with LoopJPEG.
Example:
Notes:
Call FinishJPEG even if this failes.
Returns true if you can loop using LoopJPEG.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 3.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Example:
dim g as FolderItem
dim ji as JPEGImporterMBS
dim je as JPEGExporterMBS
dim f as FolderItem
dim m as MemoryBlock
// this code copies a JPG: CMYK or RGB
// import it
g=SpecialFolder.Desktop.Child("PICT1533.JPG")
ji=new JPEGImporterMBS
ji.File=g
ji.AllowDamaged=true
ji.CMYK=true // if it is cmyk
if ji.InitJPEG then
do
loop until ji.LoopJPEG<>0
ji.FinishJPEG
end if
// export it
f=SpecialFolder.Desktop.child("PICT1533 copy.JPG")
je=new JPEGExporterMBS
je.File=f
je.Quality=75
if ji.CMYK then
m=ji.PictureData
je.ExportCMYK m, ji.Width, ji.Height, ji.Width*4
else
je.Picture=ji.Picture
je.Export
end if
Call FinishJPEG even if this failes.
Returns true if you can loop using LoopJPEG.
JPEGImporterMBS.LoopJPEG as Integer
Function:
Decompresses one line of the picture.
Example:
Notes:
Return values:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 3.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Example:
dim j as new JPEGImporterMBS
// fill properties...
if j.initJPEG then
do
loop until j.LoopJPEG<>0
end if
j.FinishJPEG
backdrop=j.Picture // nil if failed
Return values:
0 | Decompression was okay |
1 | Finished decompression |
2 | if there was an error. |
3 | Not initialized |
4 | Header only was requested |
JPEGImporterMBS.MarkerCount as Integer
Function:
Number of markers found in the JPEG data stream.
Example:
Notes:
Only available if ReadMarkers was true on reading the JPEG data.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 6.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Example:
dim j as JPEGImporterMBS
dim f as FolderItem
f=SpecialFolder.Desktop.Child("test.jpg")
j=new JPEGImporterMBS
j.ReadMarkers=true // else no metadata is read at all
// do the import
MsgBox str(j.MarkerCount)
JPEGImporterMBS.MarkerItem(index as Integer) as JPEGImporterMarkerMBS
Function:
Returns the marker with the given index.
Example:
Notes:
Only available if ReadMarkers was true on reading the JPEG data.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 6.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Example:
dim j as JPEGImporterMBS
dim f as FolderItem
f=SpecialFolder.Desktop.Child("test.jpg")
j=new JPEGImporterMBS
j.ReadMarkers=true // needed to fill ExifData property
// do the import
dim data as string = j.MarkerItem(0).Data
// work with data
JPEGImporterMBS.ReadHeader as boolean
Function:
Read the header of the JPEG data in a file or a memoryblock.
Example:
Notes:
You can use this function to see if the file is a JPEG image and which dimension it has.
This function calls InitJPEG and FinishJPEG, so we get all the metadata, but no picture.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 3.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Example:
dim f as FolderItem
dim j as JPEGImporterMBS
f=SpecialFolder.Desktop.Child("Jaguar1600.jpg")
j=new JPEGImporterMBS
j.file=f
if j.ReadHeader then
MsgBox str(j.Width)+" x "+str(j.Height)
else
MsgBox "no JPEG"
end if
You can use this function to see if the file is a JPEG image and which dimension it has.
This function calls InitJPEG and FinishJPEG, so we get all the metadata, but no picture.
JPEGImporterMBS.RedTestPicture as picture
Function:
Returns a 100x100 pixel big picture filles with RGB(255,0,0).
Notes: Just for testing how well the plugin picture code works.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | JPEG | MBS Images Plugin | 5.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Notes: Just for testing how well the plugin picture code works.
The items on this page are in the following plugins: MBS Images Plugin.

Links
MBS Xojo Plugins