ImgDoc_SaveInFile_JSN

Save the image document into a file.
ImgDoc_SaveInFile_JSN(imgDocRef;destFilePath;optionsJSON) ➔ success
imgDocRef Text The image document reference.
destFilePath Text The destination file path.
optionsJSON Text Options in JSON format.
↩︎ success Longint Completion status: 1 on success, 0 otherwise.

Save the image document to a file.

Parameter imgDocRef is the image document reference.

The full pathname of the destination file is specified in the destFilePath parameter. If omitted or set to an empty string, destFilePath defaults to the pathname of the document file. The pathname may be in either POSIX (recommended) or System format.

The optional parameter optionsJSON is a 4D object serialized in JSON format. Various saving options can be specified:

General Options
Property name Type Default Description
Format String The image doc’s original format.

The option’s value specifies the format to save in.

The format must support encoding.

When saving document containing more than one frame to a single-frame format (anything but TIFF and PDF), only the first frame is saved.

EmbedThumbnail Boolean False

Set to True to embed thumbnails to the output file.

The format must support embedded thumbnails.

ApplyOrientation Boolean Depends on format.

By setting this to true, the pixels are transformed according to the image orientation property and the orientation is set to up-right (kImgOrientationNormal).

The default behavior depends on the value of the image orientation property, and also on the destination format. If the destionation format supports the orientation property, the default is false. Otherwise the default is true.

Attach Boolean True

Set to True to perform a standard "Save"/"Save as..." operation. After saving the Q2Pix document is reloaded from the file it was saved in and its modification status is cleared.

For a "Export..." style operation set this to False. After exporting, the Q2Pix document remains attached to the original file and its modification status remains unchanged.

Lossy Compression
Property name Type Default Description
LossyCompressionQuality Real 0.75

Effective when saving to a lossy format, this option’s value is a real number in the range of 0.0 to 1.0, specifying the image quality.

The higher this number is, the higher the quality of the saved image will be at the expense of larger file size. Lower numbers produce smaller files, at the expense of lower image quality.

Recompress Boolean False The saving operation is optimized to avoid re-compression of lossy image data, when possible. To force re-compression, set this to True.
TIFF Compression
Property name Type Default Description
TIFFMonochromeEncoding Longint kTIFFCompressionCCITTFax4

The TIFF compression method for black and white images.

Can be one of: kTIFFCompressionNone, kTIFFCompressionCCITTRLE, kTIFFCompressionCCITTFax3, kTIFFCompressionCCITTFax4.

TIFFGrayscaleEncoding Longint kTIFFCompressionLZW

The TIFF compression method for grayscale images.

Can be one of: kTIFFCompressionNone, kTIFFCompressionLZW, kTIFFCompressionDeflate.

TIFFColorEncoding Longint kTIFFCompressionLZW

The TIFF compression method for color images.

Can be one of: kTIFFCompressionNone, kTIFFCompressionLZW, kTIFFCompressionDeflate.

Multiframe Progress Options
Property name Type Default Description
ProgressDelay Real 1.0 The delay, in seconds, before the progress starts.
ProgressCallback String "" The name of the project method that will be called with progress information.

The progress callback method has the following signature:

ProgressCallback (event; progress): success

event Longint Progress event: 1 = start, 2 = update, 3 = end.
progress Real Progress value: [0.0-1.0], or -1 if indeterminate.
success Longint Return # 0 to continue, or 0 to cancel.

Note

The ImgDoc_SaveInFile method in Q2PixLib is a wrapper to this method that passes the options parameter directly as a 4D object instead of a JSON serialization.