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.5   11.0   11.1   11.2   11.3   11.4   11.5   12.0   12.1   12.2    Statistic    FMM    Blog  

GMImage.ReadContainer

Read single image frame into current object.

Component Version macOS Windows Linux Server iOS SDK License
GraphicsMagick 10.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes Paid
MBS( "GMImage.ReadContainer"; ImageRef; data { ; Geometry; Depth; Magick } )   More

(old name: GMImage.ReadFromContainer)

Parameters

Parameter Description Example Flags
ImageRef The image reference number. 1
data The container value, either a variable or a container field.
Geometry The rectangle.
Geometry is specified as a width and height "100x200".
Can be empty.
Optional
Depth Color depth parameter. 0 Optional
Magick The codec to use to read file. Optional

Result

Returns OK or error.

Description

Read single image frame into current object.
This allows you to set options before reading in image.

You may want to use GMImage.SetBackgroundColor, GMImage.SetMagick, GMImage.SetFileName or other settings before calling this.

Examples

Convert a SVG image to PNG with alpha channel:

# Load image from container
Set Variable [ $image ; Value: MBS( "GMImage.New"; "500x500"; "transparent" ) ]
# turn on alpha channel and set background to transparent
Set Variable [ $r ; Value: MBS( "GMImage.SetType"; $image; 7 ) ]
Set Variable [ $r ; Value: MBS( "GMImage.SetBackgroundColor"; $Image; "transparent" ) ]
# read SVG
Set Variable [ $r ; Value: MBS( "GMImage.ReadContainer"; $image; SVG to PNG::InputFile; "500x500"; 0; "SVG" ) ]
# Output to container and release image
Set Field [ SVG to PNG::OutputFile ; MBS( "GMImage.WriteToPNGContainer"; $image; "test.png") ]
Set Variable [ $r ; Value: MBS("GMImage.Free"; $image) ]

Try GraphicsMagick in file WMF Conversion

Set Variable [ $image ; Value: MBS( "GMImage.New"; "300x300"; "white" ) ]
Set Variable [ $r ; Value: MBS( "GMImage.SetMagick"; $image; "EMF") ]
Set Variable [ $r ; Value: MBS( "GMImage.ReadContainer"; $Image; WMF Conversion::Input WMF) ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Error" ; $r ]
Else
    Set Field [ WMF Conversion::Output PNG ; MBS( "GMImage.WriteToPNGContainer"; $image) ]
    Set Variable [ $r ; Value: MBS("GMImage.Release"; $image) ]
End If

See also

Example Databases

Blog Entries

Created 7th April 2020, last changed 24th November 2021


GMImage.Read - GMImage.ReduceNoise

Feedback: Report problem or ask question.


Start Chat