### 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:

qpx_BlackAndWhite | 1 | Black and white
qpx_FourColors | 2 | Four colors
qpx_SixteenColors | 4 | Sixteen colors
qpx_TwoHundredFiftySixColors | 8 | 256 colors
qpx_ThousandsColors | 16 | Thousands of colors
qpx_MillionColors | 24 | Million of colors
qpx_MillionColorsPlusAlpha | 32 | Million of colors plus alpha
qpx_FourGrays | 34 | Four grays
qpx_SixteenGrays | 36 | Sixteen grays
qpx_TwoHundredFiftySixGrays | 40 | 256 grays

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
QPx_GetCompressedPictureInfo | Returns information about a QuickTime-compressed picture

QPix © Escape
Generated by QDoc 2.8 on Wed, Feb 17, 2010 17:43:37