GMImage.CompositeXY
-------------------

Compose an image onto another at specified offset and using specified algorithm.

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

MBS( "GMImage.CompositeXY"; ImageRef; OtherImageRef; xOffset; yOffset { ; CompositeOperator } ) 

**MBS**( **"GMImage.CompositeXY";** /\* Compose an image onto another at specified offset and using specified algorithm. \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$OtherImageRef**; /\* The second image reference (a number returned from the [GMImage.New](GMImageNew.md) functions)e.g. 2 \*/   
**$xOffset**; /\* The x offset.e.g. 0 \*/   
**$yOffset**; /\* The y offset.e.g. 0 \*/   
**$CompositeOperator**) /\* Optional; Optional operator.   
Can be one of the following numbers:  
UndefinedCompositeOp = 0, OverCompositeOp = 1, InCompositeOp = 2, OutCompositeOp = 3, AtopCompositeOp = 4, XorCompositeOp = 5, PlusCompositeOp = 6, MinusCompositeOp = 7, AddCompositeOp = 8, SubtractCompositeOp = 9, DifferenceCompositeOp = 10, MultiplyCompositeOp = 11, BumpmapCompositeOp = 12, CopyCompositeOp = 13, CopyRedCompositeOp = 14, CopyGreenCompositeOp = 15, CopyBlueCompositeOp = 16, CopyOpacityCompositeOp = 17, ClearCompositeOp = 18, DissolveCompositeOp = 19, DisplaceCompositeOp = 20, ModulateCompositeOp = 21, ThresholdCompositeOp = 22, NoCompositeOp = 23, DarkenCompositeOp = 24, LightenCompositeOp = 25, HueCompositeOp = 26, SaturateCompositeOp = 27, ColorizeCompositeOp = 28, LuminizeCompositeOp = 29, CopyCyanCompositeOp = 32, CopyMagentaCompositeOp = 33, CopyYellowCompositeOp = 34, CopyBlackCompositeOp = 35, DivideCompositeOp = 36.  
Default is 2.e.g. 2 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| ImageRef | The image reference number. | 1 |  |
| OtherImageRef | The second image reference (a number returned from the [GMImage.New](GMImageNew.md) functions) | 2 |  |
| xOffset | The x offset. | 0 |  |
| yOffset | The y offset. | 0 |  |
| CompositeOperator | Optional operator.    Can be one of the following numbers:   UndefinedCompositeOp = 0, OverCompositeOp = 1, InCompositeOp = 2, OutCompositeOp = 3, AtopCompositeOp = 4, XorCompositeOp = 5, PlusCompositeOp = 6, MinusCompositeOp = 7, AddCompositeOp = 8, SubtractCompositeOp = 9, DifferenceCompositeOp = 10, MultiplyCompositeOp = 11, BumpmapCompositeOp = 12, CopyCompositeOp = 13, CopyRedCompositeOp = 14, CopyGreenCompositeOp = 15, CopyBlueCompositeOp = 16, CopyOpacityCompositeOp = 17, ClearCompositeOp = 18, DissolveCompositeOp = 19, DisplaceCompositeOp = 20, ModulateCompositeOp = 21, ThresholdCompositeOp = 22, NoCompositeOp = 23, DarkenCompositeOp = 24, LightenCompositeOp = 25, HueCompositeOp = 26, SaturateCompositeOp = 27, ColorizeCompositeOp = 28, LuminizeCompositeOp = 29, CopyCyanCompositeOp = 32, CopyMagentaCompositeOp = 33, CopyYellowCompositeOp = 34, CopyBlackCompositeOp = 35, DivideCompositeOp = 36.   Default is 2. | 2 | Optional |

### Result

Returns "OK" on success.

### Description

Compose an image onto another at specified offset and using specified algorithm.  
You can use this function for example to add a watermark image.  
### Examples

Compose a picture on second:

 # load images...   
Set Variable \[ $Image1 ; Value: MBS ( "[GMImage.NewFromFile](GMImageNewFromFile.md)"; "/Users/cs/Pictures/IMG\_3625.jpg") \]   
Set Variable \[ $Image2 ; Value: MBS ( "[GMImage.NewFromFile](GMImageNewFromFile.md)"; "/Users/cs/Pictures/mond.jpg") \]   
\# put first on second   
Set Variable \[ $r ; Value: MBS ( "GMImage.CompositeXY"; $Image2 ; $Image1 ; 500; 200) \]   
\# and save to file   
Set Variable \[ $r ; Value: MBS ( "[GMImage.WriteToFile](GMImageWriteToFile.md)"; $Image2 ; "/Users/cs/Pictures/output.jpg") \]   
\# free memory   
Set Variable \[ $r ; Value: MBS ( "[GMImage.Release](GMImageRelease.md)"; $Image1 ) \]   
Set Variable \[ $r ; Value: MBS ( "[GMImage.Release](GMImageRelease.md)"; $Image2 ) \]  
Compose transparent picture on top of white background:

 # Load from container   
Set Variable \[ $BigImageRef ; Value: MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; Test::BigImage ) \]   
\# make new picture   
Set Variable \[ $NewImageRef ; Value: MBS ("[GMImage.New](GMImageNew.md)"; MBS ("[GMImage.GetWidth](GMImageGetWidth.md)"; $BigImageRef ) &amp; "x" &amp; MBS ("[GMImage.GetHeight](GMImageGetHeight.md)"; $BigImageRef ); "white") \]   
\# and compose   
Set Variable \[ $r ; Value: MBS ( "GMImage.CompositeXY"; $NewImageRef ; $BigImageRef ; 0; 0; 1 /\* over \*/) \]   
\# Store output and release the image   
Set Field \[ Test::Result ; MBS ( "[GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)"; $NewImageRef ) \]   
Set Variable \[ $Error ; Value: MBS ("[GMImage.Free](GMImageFree.md)";$BigImageRef ) \]   
Set Variable \[ $Error ; Value: MBS ("[GMImage.Free](GMImageFree.md)";$NewImageRef ) \]  
### See also

- [GMImage.Composite](GMImageComposite.md)
- [GMImage.CopyChannel](GMImageCopyChannel.md)
- [GMImage.Free](GMImageFree.md)
- [GMImage.GetHeight](GMImageGetHeight.md)
- [GMImage.GetWidth](GMImageGetWidth.md)
- [GMImage.New](GMImageNew.md)
- [GMImage.NewFromContainer](GMImageNewFromContainer.md)
- [GMImage.NewFromFile](GMImageNewFromFile.md)
- [GMImage.Release](GMImageRelease.md)
- [GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)

### Example Databases

- [GraphicsMagick/Apply Mask](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Apply%20Mask.shtml#1ScriptAnchor_)
- [GraphicsMagick/Clip Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Clip%20Image.shtml#1ScriptAnchor_)
- [GraphicsMagick/Combine Pictures](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Combine%20Pictures.shtml#1ScriptAnchor_)
- [GraphicsMagick/Create GIF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Create%20GIF.shtml#2ScriptAnchor_)
- [GraphicsMagick/Reduce Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Reduce%20Image.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 22](https://www.mbsplugins.de/archive/2022-12-22/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)
- [QR Codes for Invoices in Switzerland](https://www.mbsplugins.de/archive/2017-12-20/QR_Codes_for_Invoices_in_Switz/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2020, Seite 38](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)
- [Ausgabe 5/2011, Seite 31](https://filemaker-magazin.de/neuigkeit/3506-Appetithappen-FMM_201105-06)

This function checks for a license.

Created 18th August 2014 , last changed 28th August 2022

  
[GMImage.Composite](GMImageComposite.md) - [GMImage.Contrast](GMImageContrast.md)

[HTML Version](GMImageCompositeXY.shtml)