GMImage.SetQuality
------------------

Sets the JPEG/MIFF/PNG compression level (default 75).

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

MBS( "GMImage.SetQuality"; ImageRef; Quality ) 

**MBS**( **"GMImage.SetQuality";** /\* Sets the JPEG/MIFF/PNG compression level (default 75). \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$Quality**) /\* a number in range of 0 to 100.e.g. 75 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| Quality | a number in range of 0 to 100. | 75 |

### Result

Returns "OK" on success.

### Description

Sets the JPEG/MIFF/PNG compression level (default 75).  
### Examples

Recompresses the image with JPEG compressor and a really bad quality:

 Let ( \[   
$Image = MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; GraphicsMagick::image );   
$Result = MBS ("GMImage.SetQuality";$Image ; 5);   
$Result = MBS ("[GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)"; $Image );   
$Error = MBS ("[GMImage.Release](GMImageRelease.md)";$Image )  
\];   
$Result )  
Converts to JPEG with 90% compression:

 Set Variable \[$ImageRef ; Value:MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; Test::BigImage )\]  
Set Variable \[$Result ; Value:MBS ("GMImage.SetQuality"; $ImageRef ; 90)\]  
Set Field \[Test::Result ; MBS ( "[GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)"; $ImageRef )\]  
Set Variable \[$Error ; Value:MBS ("[GMImage.Release](GMImageRelease.md)";$ImageRef )\]  
### See also

- [DynaPDF.SetJPEGQuality](DynaPDFSetJPEGQuality.md)
- [GMImage.GetDensity](GMImageGetDensity.md)
- [GMImage.GetQuality](GMImageGetQuality.md)
- [GMImage.New](GMImageNew.md)
- [GMImage.NewFromContainer](GMImageNewFromContainer.md)
- [GMImage.Release](GMImageRelease.md)
- [GMImage.Scale](GMImageScale.md)
- [GMImage.SetProfile](GMImageSetProfile.md)
- [GMImage.SetQuiet](GMImageSetQuiet.md)
- [GMImage.Stegano](GMImageStegano.md)

### Example Databases

- [GraphicsMagick/Combine Pictures](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Combine%20Pictures.shtml#1ScriptAnchor_)
- [GraphicsMagick/GraphicsMagick Sample](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/GraphicsMagick%20Sample.shtml#20ScriptAnchor_)
- [GraphicsMagick/Image Scaling](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Image%20Scaling.shtml#3ScriptAnchor_)
- [GraphicsMagick/Reduce Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/GraphicsMagick/Reduce%20Image.shtml#1ScriptAnchor_)

### Blog Entries

- [GraphicsMagick in FileMaker, part 23](https://www.mbsplugins.de/archive/2022-12-23/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [Comparing Base Elements Plugin to MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2017-10-24/Comparing_Base_Elements_Plugin/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2011, Seite 32 bis 33](https://filemaker-magazin.de/neuigkeit/3506-Appetithappen-FMM_201105-06)

This function checks for a license.

Created 18th August 2014 , last changed 21st December 2018

  
[GMImage.SetProfile](GMImageSetProfile.md) - [GMImage.SetQuantizeColorSpace](GMImageSetQuantizeColorSpace.md)

[HTML Version](GMImageSetQuality.shtml)