MBS Plugin Documentation

Search:

Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchie

New in Version 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 9.0

The list of the   themes,   classes,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

Folderitem.OpenAsGIFMBS as GIFMBS
method, Pictures Import and Export, MBS GIF Plugin (GIF), class Folderitem, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Opens a GIF file.
Notes:
Returns nil on any error.
QuickTime is not required!

Some examples which use this method:

Folderitem.OpenAsJPEGMBS as picture
method, Pictures Import and Export, MBS JPEG Plugin (JPEGDecompression), class Folderitem, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Reads a picture from a JPEG file.
Notes: A short version of OpenAsJPEG with fileposition=0 and allowdamage=false.

Some examples which use this method:

Folderitem.OpenAsJPEGMBS(allowdamaged as Boolean) as picture
method, Pictures Import and Export, MBS JPEG Plugin (JPEGDecompression), class Folderitem, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Reads a picture from a JPEG file.
Notes: A short version of OpenAsJPEG with fileposition=0.

Some examples which use this method:

Folderitem.OpenAsJPEGMBS(allowdamaged as Boolean,fileposition as integer) as picture
method, Pictures Import and Export, MBS JPEG Plugin (JPEGDecompression), class Folderitem, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Reads a picture from a JPEG file.
Example:
dim f as folderitem
f=desktopfolder("a great jpeg picture.jpg")
me.backdrop=f.openasjpegMBS

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.

This method is not depending on any library! It works without QuickTime even on System 7, but as it contains everything needed this method is around 120 KB big!
(REALbasic's OpenAsPicture depends on QuickTime)

I wrote it mainly because Realbasic'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.

REALbasic's OpenAsPicture in contrast crashes if the picture is not 100% downloaded or instead of a crash you get a white picture.

See the folder "jpeg load crashtest" in the examples.

The two parameters are both optional. The second is to give a file position to start reading. This way you can load several JPEGs from different file position from one file.

Some examples which use this method:

Folderitem.OpenAsPNGMBS(gamma as single) as PNGPictureMBS
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 6.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Reads a picture from a PNG file.
Example:
dim f as folderitem
f=desktopfolder("a great picture.png")
me.backdrop=f.OpenAsPNGatPosition(0).pict

Notes:
This methods should read all PNG files you can get.

This method is not depending on any library! It works without QuickTime even on System 7, but as it contains everything needed this method is around 130 KB big!
(REALbasic's OpenAsPicture depends on QuickTime)

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma
A bad gamma value can give you a black image.

Some examples which use this method:

Folderitem.OpenAsTiffMBS(HeaderOnly as boolean=false) as TiffPictureMBS
method, Pictures Import and Export, MBS Tiff Plugin (Tiff), class Folderitem, Plugin version: 4.2, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Reads a picture from a TIFF file.
Example:
dim f as FolderItem
dim t as TiffPictureMBS

f=DesktopFolder.Child("008.tiff")
t=f.OpenAsTiffMBS(true)

if t<>Nil then
msgbox str(t.width)+" x "+str(t.height)
else
MsgBox "Problem?"
end if

Notes:
This method is not depending on any library! It works without QuickTime even on System 7, but as it contains everything needed this method is around 270 KB big!
(REALbasic's OpenAsPicture depends on QuickTime). The plugin supports even more stuff like zlib compressed picture data or JPEGs embedded into TIFFs.

If the function returns nil, you can use a TiffPictureMBS subclass and use the methods there so you get error messages in the error event.

Setting HeaderOnly to true will ignore the actual picture data and load only the header data.

Some examples which use this method:

Folderitem.SaveAs8BitAlphaPNGMBS(pic as picture, colors() as color, alphas() as integer, gamma as single) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 8.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves a palette based RGB picture as a PNG file with alpha.
Notes:
Pic should have no mask.
Colors must be an array with 256 values defining the palette.
Alphas must be an array with 256 values specifying the alpha value for each palette entry. 255 is opaque and 0 is transparent.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

Some examples which use this method:

Folderitem.SaveAs8BitAlphaPNGMBS(pic as picture, colors() as color, alphas() as integer, gamma as single, Interlace as Boolean, FilterType as integer) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 8.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves a palette based RGB picture as a PNG file with alpha.
Notes:
Pic should have no mask.
Colors must be an array with 256 values defining the palette.
Alphas must be an array with 256 values specifying the alpha value for each palette entry. 255 is opaque and 0 is transparent.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

If Interlace is true the Adam7 interlacing is used.
FilterType specifies the filter:

const PNG_NO_FILTERS= 0
const PNG_FILTER_NONE= 8
const PNG_FILTER_SUB= 16
const PNG_FILTER_UP= 32
const PNG_FILTER_AVG= 64
const PNG_FILTER_PAETH= 128
const PNG_FILTER_ALL= 248

Some examples which use this method:

Folderitem.SaveAs8BitPNGMBS(pic as picture, colors() as color, gamma as single) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 8.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves a palette based RGB picture as a PNG file.
Notes:
Pic should have no mask.
Colors must be an array with 256 values defining the palette.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

Some examples which use this method:

Folderitem.SaveAs8BitPNGMBS(pic as picture, colors() as color, gamma as single, Interlace as Boolean, FilterType as integer) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 8.7, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves a palette based RGB picture as a PNG file.
Notes:
Pic should have no mask.
Colors must be an array with 256 values defining the palette.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

If Interlace is true the Adam7 interlacing is used.
FilterType specifies the filter:

const PNG_NO_FILTERS= 0
const PNG_FILTER_NONE= 8
const PNG_FILTER_SUB= 16
const PNG_FILTER_UP= 32
const PNG_FILTER_AVG= 64
const PNG_FILTER_PAETH= 128
const PNG_FILTER_ALL= 248

Some examples which use this method:

Folderitem.SaveAsGIFMBS(data as GIFMBS) as boolean
method, Pictures Import and Export, MBS GIF Plugin (GIF), class Folderitem, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves a gif file.
Notes:
Returns true on success and false on any error.
QuickTime is not required!
Please check for the lzw patent in your country before using this function as you may need to pay license fees.

Some examples which use this method:

Folderitem.SaveAsJPEGMBS(pic as picture,quality as integer) as boolean
method, Pictures Import and Export, MBS JPEG Plugin (JPEGCompression), class Folderitem, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves a picture into a file using JPEG compression.
Example:
dim f as folderitem
f=desktopfolder("a great jpeg picture.jpg")
if f.SaveAsJPEGMBS(pic,75) then
msgbox "Picture saved."
end if

Notes:
This methods saves 32bit pictures to a file using JPEG Compression. Using the parameter you can specify the quality in range between 25 and 100%

This method 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 SaveAsJPEG depends on QuickTime)

See the "SaveJPEG without QuickTime" example.

You may use the function picture.bitmap to make sure that the picture is a bitmap, because this function works only for bitmap pictures.

The second parameter is optional. There you can give a file position where to start writing. This way you can save several JPEGs to different file position inside one file.

Use the JPEGExporterMBS class for more options.

Some examples which use this method:

Folderitem.SaveAsPNGMBS(pic as picture, gamma as single) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 6.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves RGB picture as PNG file.
Notes:
If pic has a mask, it is written to the file as alpha channel.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

Some examples which use this method:

Folderitem.SaveAsPNGMBS(pic as picture, gamma as single, Interlace as Boolean, FilterType as integer) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 6.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves RGB picture as PNG file.
Notes:
If pic has a mask, it is written to the file as alpha channel.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

If Interlace is true the Adam7 interlacing is used.
FilterType specifies the filter:

const PNG_NO_FILTERS= 0
const PNG_FILTER_NONE= 8
const PNG_FILTER_SUB= 16
const PNG_FILTER_UP= 32
const PNG_FILTER_AVG= 64
const PNG_FILTER_PAETH= 128
const PNG_FILTER_ALL= 248

Some examples which use this method:

Folderitem.SaveAsPNGMBS(pic as picture, mask as picture, gamma as single) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 6.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves RGB picture as PNG file.
Notes:
If mask is nil no alpha channel is written to the file.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

Some examples which use this method:

Folderitem.SaveAsPNGMBS(pic as picture, mask as picture, gamma as single, Interlace as Boolean, FilterType as integer) as boolean
method, Pictures Import and Export, MBS PNG Plugin (PNG), class Folderitem, Plugin version: 6.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Saves RGB picture as PNG file.
Notes:
If mask is nil no alpha channel is written to the file.

Returns true on success and false on failure.

The gamma parameter defines what gamma correction is applied:
positive value: use the value as the gamma correction
zero: use default value (or value saved in file itself)
negative value: do not correct gamma

If Interlace is true the Adam7 interlacing is used.
FilterType specifies the filter:

const PNG_NO_FILTERS= 0
const PNG_FILTER_NONE= 8
const PNG_FILTER_SUB= 16
const PNG_FILTER_UP= 32
const PNG_FILTER_AVG= 64
const PNG_FILTER_PAETH= 128
const PNG_FILTER_ALL= 248

Some examples which use this method:

The items on this page are in the following plugins: MBS GIF Plugin, MBS JPEG Plugin, MBS PNG Plugin, MBS Tiff Plugin.