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.
On Windows the file APIs in GraphicsMagick only do ANSI file paths. MacOS and Linux can do full Unicode.
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
- GMImage.GetProfile
- GMImage.GetSize
- GMImage.Magnify
- GMImage.Minify
- GMImage.NewFromBase64
- GMImage.NewFromContainer
- GMImage.Release
- Path.FileMakerPathToNativePath
- PDFKit.GetPDFPageImage
- WinPDF.PageImage
Release notes
- Version 14.4
- Fixed a problem with GMImage.NewFromFile and Japanese characters on Windows.
- Version 13.0
- Changed JPEG loader for GMImage.NewFromContainer, GMImage.NewFromFile and related to not stop loading of an image on a warning.
- Version 8.4
- Added Magick parameter for GMImage.NewFromFile function.
- Fixed problem with GMImage.NewFromFile function.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 14.4pr3
- Tips and tricks with MBS
- GraphicsMagick in FileMaker, part 7
- GraphicsMagick in FileMaker, part 5
- GraphicsMagick in FileMaker, part 4
- MBS FileMaker Plugin, version 12.6pr1
- GraphicsMagick in FileMaker, part 1
- Create PDF from scanned images and skip blank pages
- MBS FileMaker Plugin, version 8.4pr4
- MBS FileMaker Plugin, version 8.4pr1
This function checks for a license.
Created 18th August 2014, last changed 19th August 2024