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:
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
11.3
11.4
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 |
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.
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" ) ]
Insert picture from device and then convert HEIF
# let user take a picture
Insert from Device [ Contacts::Photo Container ; Type: Camera ; Camera: Back; Resolution: Full ]
#
# check filename
Set Variable [ $name ; Value: GetAsText(Contacts::Photo Container) ]
Set Variable [ $extension ; Value: Right ( $name ; 5 ) ]
If [ $extension = ".heif" or $extension = ".heic" ]
# we got a HEIF image
#
# get new file name
Set Variable [ $name ; Value: Substitute($name; ".heif"; ".png") ]
Set Variable [ $name ; Value: Substitute($name; ".heic"; ".png") ]
#
# now convert to PNG
Set Variable [ $image ; Value: MBS( "Container.ReadImage"; Contacts::Photo Container; "PNG"; $name ) ]
If [ MBS("IsError") = 0 ]
# save on success to container
Set Field [ Contacts::Photo Container ; $name ]
Else
Show Custom Dialog [ "Read Image Failed?" ; $image ]
End If
End If
Created 29th July 2018, last changed 17th June 2021
Container.ReadFile - Container.ReadImageFile
Feedback: Report problem or ask question.