DynaPDF.SetJPEGQuality
----------------------

Sets the quality of JPEG compressed images in percent if JPEG compression is used.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [3.1](newinversion31.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.SetJPEGQuality"; PDF; Quality ) 

**MBS**( **"DynaPDF.SetJPEGQuality";** /\* Sets the quality of JPEG compressed images in percent if JPEG compression is used. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Quality**) /\* The new JPEG quality. From 0 to 100.e.g. 75 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| Quality | The new JPEG quality. From 0 to 100. | 75 |

### Result

Returns OK on success.

### Description

Sets the quality of JPEG compressed images in percent if JPEG compression is used.   
Lower values cause higher compression rates, however, worse image quality.  
The function accepts also negative values. A negative value indicates that the pass-through mode for JPEG images should be disabled. Note that JPEG images are always recompressed if the pass-through mode is disabled.  
If the JPEG2000 compression filter is used the value represents a divisor of the uncompressed image size to the whished compressed image size. The possible range is 0 to 1000. If the value is 0 or 1000 the loss-less variant of JPEG compression is used (see also [DynaPDF.InsertImage](DynaPDFInsertImage.md)). Lower values cause higher compression rates, however, worse image quality.  
The default value is 70.  
See also [SetJPEGQuality](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetJPEGQuality.shtml) function in DynaPDF manual.

### Examples

sets quality level:

 MBS ( "DynaPDF.SetJPEGQuality"; $PDF ; 75 )  
Save JPEG image to container as script:

 Set Variable \[ $Image ; Value: MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; MyTable::BMPContainer ) \]   
Set Variable \[ $r ; Value: MBS ("[GMImage.SetQuality](GMImageSetQuality.md)";$Image ; 90) \]   
Set Field \[ MyTable::JPEGContainer ; MBS ("[GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)"; $Image ) \]   
Set Variable \[ $r ; Value: MBS ("[GMImage.Release](GMImageRelease.md)";$Image ) \]  
### See also

- [DynaPDF.DrawCircle](DynaPDFDrawCircle.md)
- [DynaPDF.GetJPEGQuality](DynaPDFGetJPEGQuality.md)
- [DynaPDF.InsertImage](DynaPDFInsertImage.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetCompressionFilter](DynaPDFSetCompressionFilter.md)
- [DynaPDF.SetSaveNewImageFormat](DynaPDFSetSaveNewImageFormat.md)
- [GMImage.New](GMImageNew.md)
- [GMImage.Release](GMImageRelease.md)
- [GMImage.SetQuality](GMImageSetQuality.md)
- [GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)

### Example Databases

- [DynaPDF/PDF Differences](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/PDF%20Differences.shtml#1ScriptAnchor_)
- [DynaPDF/Picture to PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Picture%20to%20PDF.shtml#5ScriptAnchor_)
- [DynaPDF/Scan with WIA to PDF](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Scan%20with%20WIA%20to%20PDF.shtml#24ScriptAnchor_)

### Blog Entries

- [Page Layouting in DynaPDF](https://www.mbsplugins.de/archive/2024-04-05/Page_Layouting_in_DynaPDF/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 21st June 2021

  
[DynaPDF.SetImportFlags2](DynaPDFSetImportFlags2.md) - [DynaPDF.SetLanguage](DynaPDFSetLanguage.md)

[HTML Version](DynaPDFSetJPEGQuality.shtml)