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).



NOTEThis behaviour type is only available, if the functional extension module 'Document Management' is installed and licensed.


images/download/attachments/177913928/image-2024-9-25_15-46-6-version-1-modificationdate-1727271965329-api-v2.png

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:

images/download/attachments/177913928/image2020-5-11_12-44-29-version-1-modificationdate-1727271811912-api-v2.png

  • 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.

images/download/attachments/177913928/image2020-5-11_12-45-0-version-1-modificationdate-1727271811902-api-v2.png

  • 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.


images/download/attachments/177913928/image-2024-9-26_10-56-26-version-1-modificationdate-1727340985991-api-v2.png

  • For the Button '-90°' a behaviour is configured that reacts to the Triggering event Click.


  • The Behaviour type Rotate image is used here with the linked element 'Target image' (Image/Icon).


  • To demonstrate the rounding logic, an Angle of -46 was specified here, which causes a 90° counter-clockwise rotation. A value of 90 would be functionally equivalent and more transparent.


  • The format image/png was chosen as Type for the target image.


  • Under the Actions on 'true', the Set value action is called to assign the rotated image ($input) to the Image/Icon element 'Target image'.

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°.