GMImage.Colorize
----------------

Colorize image with pen color, using specified percent opacity.

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

MBS( "GMImage.Colorize"; ImageRef; Opacity; penColor ) 

**MBS**( **"GMImage.Colorize"** /\* Colorize image with pen color, using specified percent opacity. \*/  
**$ImageRef**; /\* The image reference number. e.g. 1 \*/   
**$Opacity**; /\* Percent from 0 to 100. e.g. 50 \*/   
**$penColor**) /\* A color specification.   
Multiple formats are supported including various color names and # with hex number.  
See FAQ for details. e.g. "RGB 1 0 0" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| Opacity | Percent from 0 to 100. | 50 |
| penColor | A color specification.    Multiple formats are supported including various color names and # with hex number.   See [FAQ for details](https://www.monkeybreadsoftware.com/filemaker/faq.shtml#56). | "RGB 1 0 0" |

### Result

Returns "OK" on success.

### Description

Colorize image with pen color, using specified percent opacity.  
Blends the fill color with each pixel in the image.  
A percentage blend is specified with opacity. Control the application of different color components by specifying a different percentage for each component (e.g. 90/100/10 is 90% red, 100% green, and 10% blue).  
### Examples

Colorize an image:

 Set Variable \[ $image ; Value: MBS ( "[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; test::Input ) \]   
Set Variable \[ $r ; Value: MBS ( "GMImage.Colorize"; $image ; 50; "RGB 1 0 0" ) \]   
Set Field \[ test::Output ; MBS ( "[GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)"; $image ) \]   
Set Variable \[ $r ; Value: MBS ( "[GMImage.Release](GMImageRelease.md)"; $image ) \]  
### See also

- [GMImage.ColorizeRGB](GMImageColorizeRGB.md)
- [GMImage.Composite](GMImageComposite.md)
- [GMImage.New](GMImageNew.md)
- [GMImage.NewFromContainer](GMImageNewFromContainer.md)
- [GMImage.Release](GMImageRelease.md)
- [GMImage.Solarize](GMImageSolarize.md)
- [GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md)

This function checks for a license.

Created 18th August 2014 , last changed 30th June 2026

  
[GMImage.Coders](GMImageCoders.md) - [GMImage.ColorizeRGB](GMImageColorizeRGB.md)

[HTML Version](GMImageColorize.shtml)