Rotate image
See also: Rotate image (Event action)
The Rotate image behaviour creates a target image rotated by multiples of 90° clockwise or counterclockwise in a defined target format, beginning with an original image (in a pixel graphics format).
►NOTE◄ This behaviour type is only available, if the functional extension module 'Document Management' is installed and licensed.
The Behaviour type Rotate image generates a target image rotated by a multiple of 90° clockwise or counter-clockwise in a defined target format from an original image (in a pixel graphics format).
The original image can be provided in FileInfo format (for details see File) or as a ByteArray. With regard to the origin of such data, the following alternatives exist:
If no element is linked, the original image must be available as input data.
If an element is linked (e.g. of File or Image/Icon type), the system attempts to read its value as an original image.
The Angle parameter accepts negative and positive integers, which, rounded to multiples of 90, indicate the angle of rotation to be applied:
Positive values (>45°) define a clockwise rotation.
Negative values (<-45°) define a counter-clockwise rotation.
For example, a rotation angle of -90° is equivalent to a rotation angle of 270°.
The selection for the Type defines the target format for the rotated image. The format image/png is preset here.
►NOTE◄ The alternative target format image/jpeg does not support transparent color. Therefore, transparent pixels in the original may appear in black (see example).
If unsuitable or no data is available for the original image at runtime, the Actions on 'false' are executed with an error object as input data ($input).
If the original image can be processed successfully, the data of the rotated image is passed to the Actions on 'true'. There the rotated image, e.g. by Set value, can be assigned to a suitable target element.
Example
In a portal, a loaded original image is converted into a certain target format and then optionally rotated to create a target image, which can be saved.
Runtime example:
Here an pixel graphics image in image/png format that uses a transparent background has been loaded into an Image/Icon element 'Original image'.
A click on the Button '►JPG' transfers the image data into the Image/Icon elements 'Target format' and 'Target image' and converts them into image/jpeg.
This is achieved by the behaviour type Rotate image with Type image/jpeg and Angle 0.
In a second interactive step, the 'target image' was rotated here by clicking the '-90°' Button.
This is achieved by the behaviour type Rotate image with the configuration shown below.
Configuration:
Only the configuration for the Button '-90°' is explained here.
|
►NOTE◄ Since the target image is also linked as a data source for the image data, the Button can be clicked repeatedly to rotate the image counter-clockwise in steps of 90°. |