QPix Command Reference
![]() |
![]() ![]() |
QPx_ExportPicture(pictVar; targetPath; targetType; exportSettings; exportOptions):error | |||
![]() |
pictVar | Picture | Picture variable |
![]() |
targetPath | Text | Pathname to the target file |
![]() |
targetType | String4 | 4-char image type identifier |
![]() |
exportSettings | BLOB | Export settings |
![]() |
exportOptions | Longint | Export options (optional) |
![]() |
error | Longint | Error result |
Saves a picture variable in an image file (was QPx_SavePictureInFile).
The source picture is passed in the pictVar parameter.
The target (destination) file is specified by targetPath. The target file may not already exist, but its containing folder path must be valid. If targetPath points to an existing file, the latter will be replaced by the new file. If targetPath is empty, a file selection dialog is presented for the user to select the target directory and specify a file name.
The targetType parameter specifies the target file format. If targetPath is specified and targetType is passed an empty string, targetType defaults to "PICT". If targetPath is not specified, both the target path and type will have to be selected from the file selection dialog. In any other case, an error will be generated (qpx_ParamErr). If the user cancels the dialog, error qpx_userCancelErr is returned.
QPix defines the following constants for the export formats supported by QuickTime.
qpx_JPEGFile | "JPEG" | JPEG/JIFF file format |
qpx_TIFFFile | "TIFF" | TIFF file format |
qpx_PNGFile | "PNGf" | PNG file format |
qpx_BMPFile | "BMPf" | BMP file format |
qpx_PhotoshopFile | "8BPS" | Adobe Photoshop file format |
qpx_PictureFile | "PICT" | Apple PICT file format |
qpx_QTImageFile | "qtif" | QuickTime Image file format |
qpx_TargaFile | "TPIC" | Truevision Targa file format |
qpx_SGIImageFile | ".SGI" | Silicon Graphics SGI file format |
qpx_MacPaintFile | "PNTG" | Apple MacPaint file format |
qpx_JPEG2000File | "jp2 " | JPEG 2000 file format (supported on Mac OS X only) |
The exportSettings parameter can be used to specify format-specific settings for the export operation, and to receive settings after a successful image export. Not all export formats support settings. If the specified export format does not support settings, this parameter is ignored. If an empty BLOB is passed, format-specific defaults are used.
Note: The exportSettings BLOB parameter must contain valid export settings. The structure of this BLOB is known as a QuickTime Atom Container. This BLOB cannot be easilly parsed, constructed, or altered with 4D BLOB commands. Normally you let the user modify the export settings by calling the QPx_DoExportSettingsDialog high-level command. If you really want to fiddle with the settings BLOB, you will find the QTAtoms plug-in handy. QTAtoms.bundle is included in the QPix distribution package.
The exportOptions paramater is optional. It can be used to specify additional export options. The following constant is supported.
qpx_ExportThumbnail | 0x0008 | Create an embedded thumbnail inside an exported image. Currently supported only by the JPEG and TIFF exporters. The embedded thumbnails are 160 x 120 pixels max by default, in compliance with the Exif2.1/DCF specification. This can be changed through the /export/exif-thumb-width and /export/exif-thumb-height plug-in options. |
Example
`Convert a 4D picture to TIFF C_LONGINT($error) C_PICTURE($picture) C_TEXT($destPath) C_BLOB($settings) $picture:=[Images]Picture $destPath:="Macintosh HD:Image.tiff" $error:=QPx_ExportPicture ($picture;$destPath;qpx_TIFFFile;$settings) If ($error#qpx_noErr) `Handle the error End if |
Related commands
QPx_GetExportTypes | Returns the list of available export types |
QPx_DoExportSettingsDialog | Displays the export settings dialog for a specific file type |