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:
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
Statistic
FMM
Blog
Writes the picture in JPEG format to a container value which you can store in a container field.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
GraphicsMagick | 2.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
ImageRef | The image reference number. | 1 | |
Filename | The file name to use for the container. Default is "image.jpg" | "ball.jpg" | Optional |
Returns a container value.
Recompresses the image with JPEG compressor and a really bad quality:
Let ( [
$Image = MBS("GMImage.NewFromContainer"; GraphicsMagick::image);
$Result = MBS("GMImage.SetQuality";$Image; 5);
$Result = MBS("GMImage.WriteToJPEGContainer"; $Image);
$Error = MBS("GMImage.Release";$Image)
];
$Result)
Save JPEG image to container as script:
Set Variable [ $Image ; Value: MBS("GMImage.NewFromContainer"; MyTable::BMPContainer) ]
Set Variable [ $r ; Value: MBS("GMImage.SetQuality";$Image; 90) ]
Set Field [ MyTable::JPEGContainer ; MBS("GMImage.WriteToJPEGContainer"; $Image) ]
Set Variable [ $r ; Value: MBS("GMImage.Release";$Image) ]
Read image and scale down for preview:
Set Variable [ $image ; Value: MBS( "GMImage.NewFromContainer"; $input) ]
If [ MBS("IsError") = 0 ]
# limit size
Set Variable [ $scale ; Value: MBS("GMImage.Scale";$Image; "1000>") ]
# remove metadata
Set Variable [ $r ; Value: MBS( "GMImage.SetProfile"; $image; "IPTC"; "" ) ]
Set Variable [ $r ; Value: MBS( "GMImage.SetProfile"; $image; "EXIF"; "" ) ]
Set Variable [ $r ; Value: MBS( "GMImage.SetProfile"; $image; "XMP"; "" ) ]
# save
Set Variable [ $NewImage ; Value: MBS("GMImage.WriteToJPEGContainer"; $Image) ]
If [ MBS("IsError") = 0 ]
Set Field [ Get Preview::Preview ; $NewImage ]
Set Field [ Get Preview::Made using ; "GraphicsMagick" ]
Set Variable [ $r ; Value: MBS("GMImage.Release";$Image) ]
Exit Script [ Text Result: ]
End If
Set Variable [ $r ; Value: MBS("GMImage.Release";$Image) ]
End If
This function checks for a license.
Created 18th August 2014, last changed 15th April 2023