ImageGear Professional for Windows ActiveX
ConvertFile Method

Description:

Allows you to transform an image file without decoding it completely, thereby avoiding the need to load it into memory. The following types of transformations are currently supported:

This method does not process image's metadata. This is responsibility of the user. See filter sample for an example of working with metadata.

See the Remarks section, below, for more detailed usage information.

Syntax:

      ConvertFile(SrcFileName as String, DstFileName as String,
DstFormat as enumIGFormats, Command as
enumIGConversionCommands, Options as enumIGConversionOptions)

Parameters:

Name Description
SrcFileName Source file name
DstFileName Destination file name
DstFormats Destination format
Command Conversion commands
Options Conversion options

Return Value:

N/A

Bits Per Pixel:

N/A

Sample:

None

Remarks:

This section provides detailed information about the following:

Lossless Conversion of JPEG Compressed Image Files

This method allows to apply certain operations on JPEG compressed image files, such as rotation, flipping, etc, without degradation of image quality. It can be used also for lossless conversion between JFIF JPEG and EXIF JPEG file formats, and for adding a thumbnail to a JFIF of EXIF file.

Transformation is done on the DCT coefficients rather than on decompressed pixels, so the lossy decompression/compression stages are not involved.

In contrast, the usual way (to load, rotate and save image) results in significant image degradation, especially when high compression rate is used.

This method can be useful for converting photographic images between portrait and landscape layouts.

The following lossless operations (Command argument) are supported:

IG_CONVERT_NONE No conversion
IG_CONVERT_ROTATE_90 Rotate 90
IG_CONVERT_ROTATE_180 Rotate 180
IG_CONVERT_ROTATE_270 Rotate 270
IG_CONVERT_FLIP_HORIZONTAL Flip horizontal
IG_CONVERT_FLIP_VERTICAL Flip vertical
IG_CONVERT_TRANSPOSE Flip about upper left - lower right diagonal
IG_CONVERT_TRANSVERSE Flip about upper right - lower left diagonal

IG_CONVERT_NONE mode can be used for converting between JFIF JPEG and EXIF JPEG format, or for adding a thumbnail to the image.

Option parameter is a bit mask. Only one bit flag is supported:

IG_CONVERT_OPTION_TRIM = 1

An inherent limitation of such conversions is that source image dimensions must be multiples of DCT matrix size (typically 8 or 16) to preserve the entire image. If they are not, the remaining pixels at the right and/or bottom are undefined after transform. The method fills them with mirror projection of the preceding pixels. This may work well enough for many photographic pictures. If you don't like to keep mirrored edge, set Option parameter to IG_CONVERT_OPTION_TRIM. With this option set, the method will trim result image dimensions to a multiple of DCT size. In particular:

IG_CONVERT_NONE Resulting image dimensions will not be modified
IG_CONVERT_ROTATE_90 Resulting image width can be trimmed
IG_CONVERT_ROTATE_180 Resulting image width and height can be trimmed
IG_CONVERT_ROTATE_270 Resulting image height can be trimmed
IG_CONVERT_FLIP_HORIZONTAL Resulting image width can be trimmed
IG_CONVERT_FLIP_VERTICAL Resulting image height can be trimmed
IG_CONVERT_TRANSPOSE Resulting image dimensions will not be modified
IG_CONVERT_TRANSVERSE Resulting image width and height can be trimmed

The following formats are supported as both source and destination: JFIF-JPEG, EXIF-JPEG. Only Lossy and Progressive compressions are supported. If any other format is used for either source or destination, the method will set an error.

If FormatType == IG_FORMAT_UNKNOWN, the method will recognize source file format and use it for the destination file to save.

This method also converts image's thumbnail, if it is present. If the thumbnail is JPEG compressed, it will be converted without degradation of quality. If the source image does not contain a thumbnail, and destination filter's SAVE_THUMNBAIL control parameter is set to True, the method will create a thumbnail from the source image.

Conversion between PDF and PostScript Formats

This method can also be used for conversion of the entire document from PDF to PostScript or back. The method's parameters should be set as follows to achieve that:

SrcFileName Name of the input PDF or PS document to convert
DstFileName Name of the output PDF or PS document
FormatType Save format, either IG_FORMAT_PDF, or IG_FORMAT_POSTSCRIPT
Command IG_CONVERT_NONE
Options Not used, set to 0

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback