Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides
New in version: 5.4   6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2    Statistic  


Construct a blank image canvas of specified size and color.

Component: GraphicsMagick
Version: 2.0
Mac OS X: Yes
Windows: Yes
Server: Yes
FileMaker Cloud: Yes

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


Parameter Description Example value
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 255.
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"


Returns the ImageRef number on success.


Construct a blank image canvas of specified size and color.
Please call GMImage.Destroy later to free memory for this image.
Image reference numbers are starting at 18000 and counting up for each new image.


New white image:

MBS( "GMImage.New"; "16x16"; "white" )

New red image:

MBS( "GMImage.New"; "16x16"; "COLOR 255 0 0" )

Create red square and save to container:

Set Variable [$img; Value:MBS( "GMImage.New"; "16x16"; "red" )]
Set Field [test::test; MBS( "GMImage.WriteToPNGContainer"; $img; "test.png" )]
Set Variable [$r; Value:MBS( "GMImage.Destroy"; $img)]

Build in a calculation:

SetVars ( [

img = MBS( "GMImage.New"; "16x16"; "random" );
result = MBS( "GMImage.WriteToPNGContainer"; img; "test.png" );
r = MBS( "GMImage.Destroy"; 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"; $img; 1)]
#Set background color and fill
Set Variable [$r; Value:MBS( "GMImage.SetBackgroundColor"; $img; "COLOR 255 0 0 0.5")]
Set Variable [$r; Value:MBS( "GMImage.Erase"; $img)]
#Write to field
Set Variable [$pic; Value:MBS( "GMImage.WriteToPNGContainer"; $img; "test.png" )]
Set Field [test::r; $pic]
Set Variable [$r; Value:MBS( "GMImage.Destroy"; $img)]

See also

GMImage.Negate   -   GMImage.NewFromBase64

Feedback: Report problem or ask question.

MBS FileMaker Plugins - Nachhilfe in Nickenich