Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

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 3.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.SetJPEGQuality"; PDF; quality )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $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). Lower values cause higher compression rates, however, worse image quality.
The default value is 70.

See also SetJPEGQuality 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"; MyTable::BMPContainer) ]
Set Variable [ $r ; Value: MBS("GMImage.SetQuality";$Image; 90) ]
Set Field [ MyTable::JPEGContainer ; MBS("GMImage.WriteToJPEGContainer"; $Image) ]
Set Variable [ $r ; Value: MBS("GMImage.Release";$Image) ]

See also

Example Databases

Blog Entries

This function checks for a license.

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


DynaPDF.SetImportFlags2 - DynaPDF.SetLanguage