QPix Command Reference Compression |

### QPx_CompressPicture

QPx_CompressPicture(pictVar; codecType; compQuality; compDepth; compFlags):error
| pictVar | Picture | Picture variable
| codecType | String4 | Codec type
| compQuality | Longint | Compression quality
| compDepth | Longint | Compression depth, optional
| compFlags | Longint | Compression flags, optional
| error | Longint | Error result

Compresses the image contained in a 4D picture variable.

The pictVar parameter initially contains the uncompressed picture. When the command completes, it will contain the compressed picture.

The codecType parameter specifies the codec (compressor component) that will do the compression. For a list of available codecs, use the QPx_GetCodecList command.

The compQuality parameter specifies the quality of the compressed picture. Valid values are in the range of 0 - 1024. QPix defines the following constants for the compQuality parameter:

qpx_MinQuality | 0 | Minimal quality
qpx_LowQuality | 256 | Low quality
qpx_NormalQuality | 512 | Normal quality
qpx_HighQuality | 768 | High quality
qpx_MaxQuality | 1023 | Maximum quality
qpx_LosslessQuality | 1024 | Lossless quality

The compDepth parameter specifies color depth for the compressed image. If omitted or set to 0, QPix uses the original picture depth QuickTime determines the appropriate value for the picture (best depth). Possible values for compDepth are:

Black and white images | 1
Color images | 2, 8, 16, 24, 32
Grayscale images | 34 (2 bit), 36 (4-bit), 40 (8-bit)

The optional compFlags parameter specifies additional compression options. Currently, the only supported option is to display a progress dialog if the compression will take long to complete. To display the progress dialog, set the compFlags parameter to 1.

Notes

- Not all codecs support all quality and depth values. If a codec does not support the specified values for quality or depth, it will automatically fall back to its respective default values.
- To decompress a picture, compress it with the "raw " codec, or using QPx_RotatePicture($pict;0) or QPx_ResizePicture($pict;1;1)

Example

``Compress a picture with the "jpeg" codec` `` `C_LONGINT($error)` `C_PICTURE($picture)` `` `$picture:=[Images]Picture` `` `$error:=QPx_CompressPicture ($picture;"jpeg";qpx_NormalQuality)` `` `If ($error=qpx_noErr)` `` `[Images]Picture:=$picture` `` `End if` ``

Related commands

QPx_DoCodecSettingsDialog | Displays the standard compression settings dialog
QPx_GetCodecList | Returns the list of available compressors/decompressors

QPix © Escape Information Services
Generated by QDoc 2.6 on Thu, 2 May 2002 00:49:52 +0300