| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
GMImage.Colorize
Colorize image with pen color, using specified percent opacity.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| GraphicsMagick | 2.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "GMImage.Colorize"; ImageRef; Opacity; penColor ) More
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. |
"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"; test::Input ) ]
Set Variable [ $r ; Value: MBS( "GMImage.Colorize"; $image; 50; "RGB 1 0 0" ) ]
Set Field [ test::Output ; MBS( "GMImage.WriteToPNGContainer"; $image) ]
Set Variable [ $r ; Value: MBS( "GMImage.Release"; $image) ]
Set Variable [ $r ; Value: MBS( "GMImage.Colorize"; $image; 50; "RGB 1 0 0" ) ]
Set Field [ test::Output ; MBS( "GMImage.WriteToPNGContainer"; $image) ]
Set Variable [ $r ; Value: MBS( "GMImage.Release"; $image) ]
See also
- GMImage.ColorizeRGB
- GMImage.Composite
- GMImage.New
- GMImage.NewFromContainer
- GMImage.Release
- GMImage.Solarize
- GMImage.WriteToPNGContainer
This function checks for a license.
Created 18th August 2014, last changed 30th June 2026
MarkDown version: GMImageColorize.md