GMImage.Read
------------

Read single image frame into current object.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [GraphicsMagick](component_GraphicsMagick.md) | [8.3](newinversion83.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "GMImage.Read"; ImageRef; Spec { ; Geometry } ) 

**MBS**( **"GMImage.Read";** /\* Read single image frame into current object. \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$Spec**; /\* The image specification.  
e.g. native file path \*/   
**$Geometry**) /\* Optional; The image size.   
Geometry is specified as a width and height "100x200". With an optional offset "100x200+10+20". For percent values, add a percent on the end, for % values add a %: "100x200%!"e.g. "100x200" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| ImageRef | The image reference number. | 1 |  |
| Spec | The image specification.   e.g. native file path |  |  |
| Geometry | The image size.    Geometry is specified as a width and height "100x200". With an optional offset "100x200+10+20". For percent values, add a percent on the end, for % values add a %: "100x200%!" | "100x200" | Optional |

### Result

Returns OK or error.

### Description

Read single image frame into current object.  
This allows you to directly specify the coders to use and include options.  
  
e.g. gradient coder takes a range of two colors to create gradient.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) 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](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Reads in a gradient image:

 Set Variable \[ $image ; Value: MBS ( "[GMImage.New](GMImageNew.md)"; "200x200"; "white" ) \]   
Set Variable \[ $r ; Value: MBS ( "GMImage.Read"; $image ; "gradient:#20a0ff-#ffff00;" ) \]   
// Set Variable \[ $r ; Value: MBS ( "GMImage.Read"; $image ; "gradient:white-black" ) \]   
Set Field \[ Contacts::Photo Container ; MBS ( "[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; $image ; "gradient.png") \]   
Set Variable \[ $r ; Value: MBS ( "[GMImage.Release](GMImageRelease.md)"; $image ) \]  
### See also

- [GMImage.New](GMImageNew.md)
- [GMImage.ReadContainer](GMImageReadContainer.md)
- [GMImage.Release](GMImageRelease.md)
- [GMImage.Repage](GMImageRepage.md)
- [GMImage.Roll](GMImageRoll.md)
- [GMImage.Rows](GMImageRows.md)
- [GMImage.SetBackgroundColor](GMImageSetBackgroundColor.md)
- [GMImage.Spread](GMImageSpread.md)
- [GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Release notes

- **Version 14.4**
    - Improved [GMImage.ReadContainer](https://www.mbsplugins.eu/GMImageReadContainer.shtml) to better pick decoder based on file name.
- **Version 10.2**
    - Added [GMImage.ReadFromContainer](https://www.mbsplugins.eu/GMImageReadFromContainer.shtml) function.
- **Version 8.3**
    - Added [GMImage.Read](http://www.mbsplugins.eu/GMImageRead.shtml) function, useful to create gradient images.

### Blog Entries

- [MBS FileMaker Plugin, version 8.3pr1](https://www.mbsplugins.de/archive/2018-06-04/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 25th May 2018 , last changed 15th July 2020

  
[GMImage.RandomThresholdChannel](GMImageRandomThresholdChannel.md) - [GMImage.ReadContainer](GMImageReadContainer.md)

[HTML Version](GMImageRead.shtml)