GMImage.SetDepth
----------------

Sets the Image depth (bits allocated to red/green/blue components)

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

MBS( "GMImage.SetDepth"; ImageRef; Depth ) 

**MBS**( **"GMImage.SetDepth";** /\* Sets the Image depth (bits allocated to red/green/blue components) \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$Depth**) /\* The bit depth.e.g. 8 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| Depth | The bit depth. | 8 |

### Result

Returns "OK" on success.

### Description

Sets the Image depth (bits allocated to red/green/blue components)  
### See also

- [Barcode.Generate](BarcodeGenerate.md)
- [GMImage.GetDebug](GMImageGetDebug.md)
- [GMImage.GetDepth](GMImageGetDepth.md)
- [GMImage.GetWidth](GMImageGetWidth.md)
- [GMImage.Segment](GMImageSegment.md)
- [GMImage.SetDebug](GMImageSetDebug.md)
- [GMImage.SetDensity](GMImageSetDensity.md)
- [GMImage.SetFont](GMImageSetFont.md)
- [GMImage.SetMatte](GMImageSetMatte.md)
- [GMImage.SetType](GMImageSetType.md)

### Release notes

- **Version 11.0**
    - Changed [Barcode.Generate](https://www.mbsplugins.eu/BarcodeGenerate.shtml) to default to 8-bit per channel for the generated image to avoid trouble if receiving software can't handle 16 bit per channel. You can still change with [GMImage.SetDepth](https://www.mbsplugins.eu/GMImageSetDepth.shtml), e.g. to make a monochrome version.

### Blog Entries

- [MBS FileMaker Plugin, version 10.6pr1](https://www.mbsplugins.de/archive/2020-12-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

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

  
[GMImage.SetDensity](GMImageSetDensity.md) - [GMImage.SetEXIFOrientation](GMImageSetEXIFOrientation.md)

[HTML Version](GMImageSetDepth.shtml)