Compressing Still Images

The standard dialog component provides three functions you may use to compress a still image. These functions differ based on how the image is stored: SCCompressImage works with pixel maps; SCCompressPicture compresses a picture that is stored in a handle; and SCCompressPictureFile works with pictures stored in files.

SCCompressPicture

The SCCompressPicture function compresses a picture that is stored in a handle.

FUNCTION SCCompressPicture (ci as ComponentInstance,srcPicture as PicHandle,dstPicture as PicHandle ) as Integer

ci
Identifies your application's connection to a standard image-compression dialog component.
srcPicture
Contains a handle to the picture to be compressed.
dstPicture
Contains a handle to the compressed picture. The standard dialog component resizes this handle to accommodate the compressed picture. Your application is responsible for creating and disposing of this handle when you are done with it.

RESULT CODES

scUserCancelled

1

Dialog box canceled--user clicked Cancel

Image Compression Manager errors (from FCompressPicture function)

SCCompressPictureFile

The SCCompressPictureFile function compresses a picture that is stored in a file.

FUNCTION SCCompressPictureFile(ci as ComponentInstance,srcRefNum as Integer,dstRefNum as Integer)

ci
Identifies your application's connection to a standard image-compression dialog component.
srcRefNum
Contains a reference to the file to be compressed.
dstRefNum
Contains a reference to the file that is to receive the compressed data. This may be the same as the source file. The standard dialog component places the compressed image data into the file identified by this reference. Your application is responsible for this file after the compression operation.

RESULT CODES

scUserCancelled

1

Dialog box canceled--user clicked Cancel

Image Compression Manager errors (from FCompressPictureFile function)