GMImage.New
-----------

Construct a blank image canvas of specified size and color.

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

MBS( "GMImage.New"; Geometry; Color ) 

**MBS**( **"GMImage.New";** /\* Construct a blank image canvas of specified size and color. \*/  
**$Geometry**; /\* The rectangle. 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" \*/   
**$Color**) /\* A color value.   
This can be a string in the following format "HSL h s l a", "YUV y u v a", "RGB r g b a", "MONO m a", "GRAY g a" or "COLOR R G B a". Alpha value a is optional. Range of values is 0 to 1.0 except if you use COLOR where RGB values are 0 to 65535.  
Starting with version 5.4 of our plugin, you can use hex notation. # followed by 2 digits for red, green, blue and optional alpha, e.g. #FF0000 for full red.e.g. "RGB 1 0 0" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Geometry | The rectangle. 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" |
| Color | A color value.    This can be a string in the following format "HSL h s l a", "YUV y u v a", "RGB r g b a", "MONO m a", "GRAY g a" or "COLOR R G B a". Alpha value a is optional. Range of values is 0 to 1.0 except if you use COLOR where RGB values are 0 to 65535.   Starting with version 5.4 of our plugin, you can use hex notation. # followed by 2 digits for red, green, blue and optional alpha, e.g. #FF0000 for full red. | "RGB 1 0 0" |

### Result

Returns the ImageRef number on success.

### Description

Construct a blank image canvas of specified size and color.  
Please call [GMImage.Release](GMImageRelease.md) later to free memory for this image.  
Image reference numbers are starting at 18000 and counting up for each new image.  
### Examples

New white image:

 MBS ( "GMImage.New"; "16x16"; "white" )  
New red image:

 MBS ( "GMImage.New"; "16x16"; "#FF0000" )  
Create red square and save to container:

 Set Variable \[$img ; Value:MBS ( "GMImage.New"; "16x16"; "red" )\]  
Set Field \[test::test ; MBS ( "[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; $img ; "test.png" )\]  
Set Variable \[$r ; Value:MBS ( "[GMImage.Release](GMImageRelease.md)"; $img )\]  
Build in a calculation:

 Let ( \[  
  
img = MBS ( "GMImage.New"; "16x16"; "random" );  
result = MBS ( "[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; img; "test.png" );  
r = MBS ( "[GMImage.Release](GMImageRelease.md)"; img)  
  
\]; result )  
Create picture with red and 50% alpha:

 #Create picture   
Set Variable \[$img ; Value:MBS ( "GMImage.New"; "16x16"; "white")\]  
\#Add alpha channel   
Set Variable \[$r ; Value:MBS ( "[GMImage.SetMatte](GMImageSetMatte.md)"; $img ; 1)\]  
\#Set background color and fill   
Set Variable \[$r ; Value:MBS ( "[GMImage.SetBackgroundColor](GMImageSetBackgroundColor.md)"; $img ; "COLOR 65535 0 0 0.5 ")\]  
Set Variable \[$r ; Value:MBS ( "[GMImage.Erase](GMImageErase.md)"; $img )\]  
\#Write to field   
Set Variable \[$pic ; Value:MBS ( "[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; $img ; "test.png" )\]  
Set Field \[test::r ; $pic \]  
\#Cleanup   
Set Variable \[$r ; Value:MBS ( "[GMImage.Release](GMImageRelease.md)"; $img )\]  
Create a transparent picture by erasing with transparent color:

 Set Variable \[ $img ; Value: MBS ("GMImage.New"; $width &amp; "x" &amp; $height ; "RGB 1 1 1") \]   
Set Variable \[ $r ; Value: MBS ( "[GMImage.SetMatte](GMImageSetMatte.md)"; $img ; 1) \]   
Set Variable \[ $r ; Value: MBS ( "[GMImage.SetBackgroundColor](GMImageSetBackgroundColor.md)"; $img ; "transparent") \]   
Set Variable \[ $r ; Value: MBS ("[GMImage.Erase](GMImageErase.md)"; $img ) \]  
### See also

- [GMImage.Free](GMImageFree.md)
- [GMImage.Map](GMImageMap.md)
- [GMImage.SkewY](GMImageSkewY.md)
- [ImageView.CreateWithSize](ImageViewCreateWithSize.md)
- [OCR.GetText](OCRGetText.md)
- [OCR.SetImage](OCRSetImage.md)
- [ProgressDialog.SetTitleIcon](ProgressDialogSetTitleIcon.md)
- [Window.SetTitleIcon](WindowSetTitleIcon.md)
- [XL.Book.AddPictureContainer](XLBookAddPictureContainer.md)
- [XL.Sheet.SetPictureWithSize](XLSheetSetPictureWithSize.md)

### Release notes

- **Version 14.4**
    - Fixed a problem with [GMImage.NewFromFile](https://www.mbsplugins.eu/GMImageNewFromFile.shtml) and Japanese characters on Windows.
- **Version 13.0**
    - Changed JPEG loader for [GMImage.NewFromContainer](https://www.mbsplugins.eu/GMImageNewFromContainer.shtml), [GMImage.NewFromFile](https://www.mbsplugins.eu/GMImageNewFromFile.shtml) and related to not stop loading of an image on a warning.
- **Version 9.5**
    - Improved JPEG detection for byte streams, so we can detect if a PNG is actually a JPEG. Now [GMImage.NewFromContainer](http://www.mbsplugins.eu/GMImageNewFromContainer.shtml) can read JPEG, GIF, PNG, TIFF and BMP even if they are passed in wrong container format.
- **Version 9.0**
    - Improved error handling for [GMImage.NewFromContainer](http://www.mbsplugins.eu/GMImageNewFromContainer.shtml), so we pass on error messages from GraphicsMagick.
- **Version 8.5**
    - Changed [GMImage.NewImagesFromFile](http://www.mbsplugins.eu/GMImageNewImagesFromFile.shtml) to reject .PDF file as GraphicsMagick doesn't really read PDF files.
- **Version 8.4**
    - Added Magick parameter for [GMImage.NewFromFile](http://www.mbsplugins.eu/GMImageNewFromFile.shtml) function.
    - Fixed problem with [GMImage.NewFromFile](http://www.mbsplugins.eu/GMImageNewFromFile.shtml) function.
- **Version 8.3**
    - Fixed [GMImage.NewFromContainer](http://www.mbsplugins.eu/GMImageNewFromContainer.shtml) to handle SVG files better.
- **Version 7.2**
    - Fixed a bug with [GMImage.NewFromContainer](http://www.mbsplugins.eu/GMImageNewFromContainer.shtml) where referenced image file would stay open.

### Example Databases

- [Barcode/Barcode Generation JSON](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Barcode%20Generation%20JSON.shtml#9ScriptAnchor_)
- [GraphicsMagick/Annotate Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Annotate%20Image.shtml#3ScriptAnchor_)
- [GraphicsMagick/Colors](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Colors.shtml#1299FieldAnchor_)
- [GraphicsMagick/Create GIF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Create%20GIF.shtml#2ScriptAnchor_)
- [GraphicsMagick/Drawing](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Drawing.shtml#1ScriptAnchor_)
- [GraphicsMagick/GraphicsMagick Path Drawing](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/GraphicsMagick%20Path%20Drawing.shtml#1ScriptAnchor_)
- [GraphicsMagick/Reduce Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Reduce%20Image.shtml#1ScriptAnchor_)
- [GraphicsMagick/Text Wrap](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Text%20Wrap.shtml#1ScriptAnchor_)
- [Overlay](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Overlay.shtml#4ScriptAnchor_)
- [Utility functions/Colors](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/Colors.shtml#1299FieldAnchor_)

### Blog Entries

- [Self made charts in FileMaker](https://www.mbsplugins.de/archive/2025-06-26/Self_made_charts_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [Create QR-Codes with circles](https://www.mbsplugins.de/archive/2025-02-13/Create_QR-Codes_with_circles/monkeybreadsoftware_blog_filemaker)
- [Custom progress bars for FileMaker](https://www.mbsplugins.de/archive/2024-04-10/Custom_progress_bars_for_FileM/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 24](https://www.mbsplugins.de/archive/2022-12-24/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 20](https://www.mbsplugins.de/archive/2022-12-20/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [Convert a SVG image to PNG with alpha channel](https://www.mbsplugins.de/archive/2020-04-07/Convert_a_SVG_image_to_PNG_wit/monkeybreadsoftware_blog_filemaker)
- [Circle crop images in FileMaker with MBS Plugin](https://www.mbsplugins.de/archive/2018-01-18/Circle_crop_images_in_FileMake/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2020, Seite 37 bis 38](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)

This function checks for a license.

Created 18th August 2014 , last changed 7th September 2025

  
[GMImage.Negate](GMImageNegate.md) - [GMImage.NewFromBase64](GMImageNewFromBase64.md)

[HTML Version](GMImageNew.shtml)