GMImage.DrawCircle
------------------

Draws a circle.

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

MBS( "GMImage.DrawCircle"; ImageRef; originX; originY; perimX; perimY ) 

**MBS**( **"GMImage.DrawCircle";** /\* Draws a circle. \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$originX**; /\* The X coordinate for start position. \*/   
**$originY**; /\* The Y coordinate for start position. \*/   
**$perimX**; /\* The X position of a point on the circle. \*/   
**$perimY**) /\* The Y position of a point on the circle. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| originX | The X coordinate for start position. |  |
| originY | The Y coordinate for start position. |  |
| perimX | The X position of a point on the circle. |  |
| perimY | The Y position of a point on the circle. |  |

### Result

Returns OK or error message.

### Description

Draws a circle.  
Draw a circle using the stroke color and thickness using specified origin and perimeter coordinates. If a fill color is specified, then the object is filled.  
  
PerimX/PerimY define a point where the circle goes through, so put it a radius away from the origin. e.g. PerimX is originX + radius while PerimY is originY.  
  
If you have an open path, the command is added there for later drawing with [GMImage.DrawPath](GMImageDrawPath.md).  
### Examples

Creates a new image and draws a circle inside:

 Set Variable \[ $img ; Value:MBS ("[GMImage.New](GMImageNew.md)"; "300x200"; "RGB 1 1 1") \]  
Set Variable \[ $r ; Value:MBS ("[GMImage.SetStrokeColor](GMImageSetStrokeColor.md)"; $img ; "RGB 1 0 0") \]   
Set Variable \[ $r ; Value:MBS ("[GMImage.SetFillColor](GMImageSetFillColor.md)"; $img ; "RGB 0 0 1") \]  
Set Variable \[ $r ; Value:MBS ("[GMImage.SetLineWidth](GMImageSetLineWidth.md)"; $img ; 5) \]  
Set Variable \[ $r ; Value:MBS ("GMImage.DrawCircle"; $img ; 150; 100; 100; 100) \]   
Set Variable \[ $png ; Value:MBS ("[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; $img ; "test.png") \]   
Set Variable \[ $r ; Value:MBS ("[GMImage.Release](GMImageRelease.md)"; $img ) \]  
Set Field \[ Drawing::Image ; $png \]  
Draws a cirlce in a rectangle in a circle:

 Set Variable \[$img ; Value:MBS ( "[GMImage.New](GMImageNew.md)"; "100x100"; "white" )\]  
Set Variable \[$r ; Value:MBS ( "[GMImage.SetFillColor](GMImageSetFillColor.md)"; $img ; "RGB 1 0 0" )\]  
Set Variable \[$r ; Value:MBS ( "[GMImage.SetStrokeColor](GMImageSetStrokeColor.md)"; $img ; "RGB 0 0 1" )\]  
Set Variable \[$r ; Value:MBS ( "GMImage.DrawCircle"; $img ; 50; 50; 50; 90 )\]  
Set Variable \[$r ; Value:MBS ( "[GMImage.DrawRectangle](GMImageDrawRectangle.md)"; $img ; 22; 22; 100-22; 100-22 )\]  
Set Variable \[$r ; Value:MBS ( "GMImage.DrawCircle"; $img ; 50; 50; 50; 100-22 )\]  
Set Field \[test::test ; MBS ( "[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; $img ; "test.png" )\]  
Set Variable \[$r ; Value:MBS ( "[GMImage.Release](GMImageRelease.md)"; $img )\]  
Draw a circle at x/y with w as radius:

 MBS ( "GMImage.DrawCircle"; $image ; $x ; $y ; $x +$w ; $y )  
### See also

- [GMImage.CopyChannel](GMImageCopyChannel.md)
- [GMImage.DrawArc](GMImageDrawArc.md)
- [GMImage.DrawLine](GMImageDrawLine.md)
- [GMImage.DrawPath](GMImageDrawPath.md)
- [GMImage.DrawRectangle](GMImageDrawRectangle.md)
- [GMImage.New](GMImageNew.md)
- [GMImage.Release](GMImageRelease.md)
- [GMImage.SetFillColor](GMImageSetFillColor.md)
- [GMImage.SetStrokeColor](GMImageSetStrokeColor.md)
- [GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)

### Example Databases

- [Barcode/Barcode Generation JSON](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Barcode%20Generation%20JSON.shtml#9ScriptAnchor_)
- [DynaPDF/Click Points](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Click%20Points.shtml#2ScriptAnchor_)
- [GraphicsMagick/Clip Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Clip%20Image.shtml#1ScriptAnchor_)
- [GraphicsMagick/Drawing](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Drawing.shtml#3ScriptAnchor_)
- [GraphicsMagick/GraphicsMagick Path Drawing](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/GraphicsMagick%20Path%20Drawing.shtml#1ScriptAnchor_)

### Blog Entries

- [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)
- [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 38](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)

This function checks for a license.

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

  
[GMImage.DrawArc](GMImageDrawArc.md) - [GMImage.DrawEllipse](GMImageDrawEllipse.md)

[HTML Version](GMImageDrawCircle.shtml)