CropImage

Mon 01 January 2018

Syntax

CropImage(src_recfield, dst_recfield, [width, height])

Description

Use the CropImage function to crop a source image existing in a database record field and save it to a different destination record field in the database. The source and destination fields must be defined with the same image format: BMP, GIF, or, JPG only.

The image cropping can be constrained to a specific aspect ratio by specifying the optional [ width and height parameters. These parameters define the aspect ratio only, and do not constrain the cropping to a specific size. If the aspect ratio is not specified, then the user will be unconstrained when cropping the image.

An error occurs and CropImage returns False when:

  • The source or destination field does not exist in the component buffer.

  • The source or destination field is not of type image

  • The image type of the destination field differs from that of the source field.

  • The destination image field is the same as the source image field.

Parameters

Field or Control

Definition

src_recfield

Specifies the record field location of the source image file.

dst_recfield

Specifies the record field location of the destination image file.

width

Specifies an aspect ratio width as a numeric value.

height

Specifies an aspect ratio height as a numeric value.

Important! If the width is specified, but the height is omitted, the PeopleCode program will pass syntax checking. However, at run time, the user will encounter an error and will not be able to crop the image.

Returns

A Boolean value: True when successful, False otherwise.

Example

&bRet = CropImage(QE_IMAGE.QE_IMAGE, QE_IMAGE_CROP.QE_CROP_IMAGE, 60, 90);