Platforms to show: All Mac Windows Linux Cross-Platform
JPEGImporterMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
class | JPEG | MBS Images Plugin | Yes | Yes | Yes | Yes | No |
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
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!
Bases on libjpeg.
- 4 events
- event Error(message as string, ErrorCode as Integer)
- event HeadersRead as boolean
- event Info(message as string, msglevel as Integer, ErrorCode as Integer)
- event Warning(message as string, ErrorCode as Integer)
- 31 properties
- property AllowDamaged as boolean
- property BlockSmoothing as Boolean
- property CMYK as Boolean
- property ColorComponentCount as Integer
- property ColorSpace as Integer
- property CurrentDepth as Integer
- property data as string
- property ErrorMessage as string
- property ExifData as String
- property FancyUpsampling as Boolean
- property file as folderitem
- property FileOffset as Integer
- property Height as Integer
- property HorizontalResolution as Integer
- property Mode as Integer
- property OriginalDepth as Integer
- property Picture as Picture
- property PictureData as MemoryBlock
- property ProfileData as String
- property ProgressiveMode as Boolean
- property ReadExifData as Boolean
- property ReadMarkers as Boolean
- property ReadProfileData as Boolean
- property ReadXMPData as Boolean
- property ResolutionUnit as Integer
- property ScaleFactor as Integer
- property VerticalResolution as Integer
- property WarningMessage as String
- property Width as Integer
- property XMPData as String
- property YieldTicks as Integer
- 12 methods
- method BlueTestPicture as picture
- method CleanMarkers
- method FinishJPEG
- method GreenTestPicture as picture
- method Import
- method ImportCMYK
- method InitJPEG as boolean
- method LoopJPEG as Integer
- method MarkerCount as Integer
- method MarkerItem(index as Integer) as JPEGImporterMarkerMBS
- method ReadHeader as boolean
- method RedTestPicture as picture
- shared method GetJPEGVersion as String
- 16 constants
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:
- /DynaPDF/CMYK Pictures/Create PDF with CMYK
- /DynaPDF/Image to PDF/Image to pdf
- /DynaPDF/Image to PDF/Multi Tiff to PDF
- /Images/JPEG/Apple ICC Profile to JPEG File
- /Images/JPEG/JPEG Benchmark
- /Images/JPEG/JPEG Modes
- /Images/JPEG/JPEG movie
- /Images/JPEG/JPEG Thread Test
- /Images/JPEG/JPEG with LCMS/JPEG with LCMS
- /Images/JPEG/JPEGToString example
- /Images/JPEG/LoadAsJPEG Example 2
- /Images/JPEG/Quickly generate previews for JPEG and Tiff
- /Images/JPEG/Recompress JPEGs
- /Images/JPEG/SaveJPEG without QuickTime2
- /Images/JPEG/StringToJPEG Example 2
- /Images/JPEG/Test on damaged JPEGs
- /Images/LargePicture/CMYK/PictureMBS with CMYK
- /Images/LargePicture/JPEG Modes
- /Images/LCMS2/Apple ICC Profile to JPEG File
- /Images/LCMS2/CMYK/CMYK Example
- /Images/LCMS2/Convert image to sRGB JPEG
Blog Entries
- MBS Xojo Plugins, version 18.2pr1
- MBS Xojo Plugins, version 17.3pr5
- MBS Xojo / Real Studio Plugins, version 15.2pr1
- MBS Xojo / Real Studio Plugins, version 15.1pr5
- MBS Xojo / Real Studio Plugins, version 15.0pr6
- MBS Xojo / Real Studio Plugins, version 13.4pr3
- JPEG String to Picture
- MBS Real Studio Plugins, version 13.1pr3
- MBS Real Studio Plugins, version 12.1pr1
The items on this page are in the following plugins: MBS Images Plugin.
Links
MBS Xojo PDF Plugins