Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.5   10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2    Statistic    FMM    Blog  


Reads and convert image.

Component Version macOS Windows Linux Server iOS SDK
Container 8.4 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "Container.ReadImage"; Container { ; ImageType; FileName } )   More


Parameter Description Example Flags
Container The container field or value to inspect. MyTable::MyContainerField
ImageType The type of image to return.
Either JPEG, PNG, GIF or BMP. Default is JPEG.
"JPEG" Optional
FileName The filename to use for the picture.
Default is "image" with the extension matching the image type.
"test.jpg" Optional


Returns image container or error.


Reads and convert image.
This function is useful to read all the image formats supported by Apple's frameworks and convert them to a common format like JPEG or PNG.
Use this function to convert old PICT images in containers.
Works as well for HEIC and HEIF images.


Convert PICT to PNG:

Set Field [ Test::output ; MBS("Container.ReadImage"; Test::OldImage; "PNG"; "image.png") ]

Read file from disk and read as image:

Set Field [ Batch Emailer::Inline Graphics ; MBS("Container.ReadImage"; MBS("Container.ReadFile"; "/Users/cs/Desktop/test.heic")) ]

Read HEIC file:

Set Variable [ $path ; Value: "/Users/cs/Desktop/IMG_3552.HEIC" ]
Set Variable [ $container ; Value: MBS( "Container.ReadFile"; $path) ]
If [ MBS("IsError") = 0 ]
    Set Variable [ $image ; Value: MBS( "Container.ReadImage"; $container; "PNG"; "image.png") ]
    If [ MBS("IsError") = 0 ]
        Set Field [ Untitled::image ; $image ]
    End If
End If

Convert a PSD or HEIF image to PNG:

Set Field [ Contacts::Output ; MBS( "Container.ReadImage"; Contacts::Input; "PNG"; "test.png" ) ]

See also

Release notes

Blog Entries

Created 29th July 2018, last changed 5th January 2021

Container.ReadFile - Container.ReadImageFile

Feedback: Report problem or ask question.

MBS Xojo Plugins

Start Chat