QPx_ExportImageFileToBLOB(sourcePath; sourcePath; sourcePath; sourcePath; sourcePath):error
sourcePath Text Pathname to source file
targetBlob BLOB BLOB to receive the image
targetType Text 4-char image type identifier
exportSettings BLOB Export settings
exportOptions Longint Export options (optional)
error Longint Error result

Export an image file in another format into a BLOB

The source file is specified by sourcePath. If sourcePath is empty, a file selection dialog is presented.

The targetBlob parameter is the BLOB where the converted image will be placed. After successful completion of the command, targetBlob receives the image data.

The targetType parameter specifies the target file format. To get the list of avaliable export formats, call the QPx_GetExportTypes command. 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 and 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. To fiddle with the settings BLOB at your own risk, use the plug-in QTAtoms.bundle that is included in the QPix distribution package.

The exportOptions parameter is optional. It can be used to specify additional export options by combining the following constants with bitwise "OR".

qpx_ExportWithProgress 0x0001 Display a progress dialog during long operations. Supported by some export components.
qpx_ExportInputProfile 0x0002 Copy the source image color profile, if any, to the output image. Supported by some export components.
qpx_ExportInputTags 0x0004 Copy the source image tags, if any, to the output image. Supported by some export components.
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.


   // Save an image file into a BLOB, in JPEG format


$imagePath:=""// This will bring up the "Open" dialog

$error:=QPx_ExportImageFileToBLOB ($imagePath;$jpegImage;qpx_JPEGFile;$settings)
If ($error#qpx_noErr)
      // Handle the error
End if 

Related commands

QPx_GetExportTypes Get the list of available exporters
QPx_DoExportSettingsDialog Display the export settings dialog for a specific file type