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

GMImage.NewFromFile

Loads a picture file.

Component Version macOS Windows Linux Server iOS SDK
GraphicsMagick 2.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "GMImage.NewFromFile"; Path { ; Magick } )   More

Parameters

Parameter Description Example Flags
Path The platform specific file path. "/test.jpg"
Magick Available in MBS FileMaker Plugin 8.4 or newer.
The magick setting to define which codec to use.
"JPG" Optional

Result

Returns the ImageRef number on success.

Description

Loads a picture file.
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 to PNG and then use GMImage.NewFromContainer function.

When the file is a PDF, please use DynaPDF.RenderPage, PDFKit.GetPDFPageImage or WinPDF.PageImage to render an image from the PDF first, before loading it.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Load an image from file path:

# Loads a picture file and returns the ImageRef number on success
Set Variable [ $RefNum; Value:MBS( "GMImage.NewFromFile"; $currentPicturePath ) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 16th April 2023


GMImage.NewFromContainer - GMImage.NewFromHex