MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

JPEGImporterMBS class

class, JPEG, MBS JPEG Plugin (JPEGDecompression), class JPEGImporterMBS,
Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: A class for JPEG Importing.
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
Notes:
This class is not depending on any library! It works without QuickTime even on System 7, but as it contains everything needed this method is around 100 KB big!
(REALbasic's OpenAsPicture depends on QuickTime)

Bases on libjpeg.

Color Spaces

Constant Value Description
ColorSpaceCMYK 4 C/M/Y/K
ColorSpaceGrayScale 1 Gray
ColorSpaceRGB 2 red/green/blue
ColorSpaceUnknown 0 Not set.
ColorSpaceYCbCr 3 Y/Cb/Cr (also known as YUV)
ColorSpaceYCCK 5 Y/Cb/Cr/K

Modes

Constant Value Description
ModeAuto 30 Load the image into the picturedata property.
Switches on import to RGB, Gray or CMYK depending on color space of JPEG file.
ModeAutoByRow 31 Load the image into the picturedata property.
Switches on import to RGB, Gray or CMYK depending on color space of JPEG file.
ModeCMYK 2 Load the image into the picturedata property.
The PictureData Memoryblock uses 4 bytes per pixel.
ModeCMYKbyRow 12 Same as ModeCMYK, but PictureData contains only the current row
The PictureData Memoryblock uses 4 bytes per pixel.
ModeGray 3 Load the image into the picturedata property.
The PictureData Memoryblock uses one byte per pixel.
ModeGraybyRow 13 Same as ModeGray, but PictureData contains only the current row
The PictureData Memoryblock uses one byte per pixel.
ModePicture 0 Load the image into the picture property.
ModeRaw 20 Load the image into the picturedata property.
The PictureData Memoryblock uses 1 to 4 bytes per pixel.

Check the colorspace property to know which color space is used.
ModeRGB 1 Load the image into the picturedata property.
The PictureData Memoryblock uses 3 bytes per pixel.
ModeRGBbyRow 11 Same as ModeRGB, but PictureData contains only the current row
The PictureData Memoryblock uses 3 bytes per pixel.

This class has no sub classes.

Some examples which use this class:


The items on this page are in the following plugins: MBS JPEG Plugin.


JPEGImporterMarkerMBS   -   JPEGMovieMBS




Links
MBS FileMaker Plugins