Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

GMImage.NewFromContainer

Loads a picture from the given container.

Component Version macOS Windows Linux Server iOS SDK
GraphicsMagick 2.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "GMImage.NewFromContainer"; data )   More

Parameters

Parameter Description Example
data A value from a Container Field.
Can include various image formats like JPEG, PNG or just containers with FILE data.

Result

Returns the ImageRef number on success.

Description

Loads a picture from the given container.
Please call GMImage.Release later to free memory for this image.
Image reference numbers are starting at 18000 and counting up for each new image.

If image doesn't load, please check whether it's a HEIC, HEIF or RAW image. For those, please use Container.ReadImage first to convert on macOS/iOS/Windows.

When the container has a PDF, the plugin may just load the preview image. Please use DynaPDF.RenderPage, PDFKit.GetPDFPageImage or WinPDF.PageImage to render an image from the PDF first, before loading it.

Examples

Show with and height

Let ( [
$Image = MBS("GMImage.NewFromContainer"; GraphicsMagick::image);
$Width = MBS("GMImage.GetWidth";$Image);
$Height = MBS("GMImage.GetHeight";$Image);
$Error = MBS("GMImage.Release";$Image)
];
$Width & " x " & $Height )

Load from container:

MBS( "GMImage.NewFromContainer"; test::test)

Invert image:

Set Variable [ $image ; Value: MBS( "GMImage.NewFromContainer"; Invert::Input ) ]
# each channel...
// Set Variable [ $r ; Value: MBS( "GMImage.InvertChannel"; $image; "red") ]
// Set Variable [ $r ; Value: MBS( "GMImage.InvertChannel"; $image) ]
// Set Variable [ $r ; Value: MBS( "GMImage.InvertChannel"; $image; "blue") ]
# all channels...
Set Variable [ $r ; Value: MBS( "GMImage.InvertChannel"; $image; "rgb") ]
Set Field [ Invert::Output ; MBS( "GMImage.WriteToPNGContainer"; $image; "output.png") ]
Set Variable [ $r ; Value: MBS( "GMImage.Release"; $image) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 22nd November 2023


GMImage.NewFromBase64 - GMImage.NewFromFile