Altova MobileTogether Designer

Transforming Images

Home Prev Top Next

A Base64-encoded image can be transformed (resized, rotated, and modified for quality/filesize) with the Altova XPath extension function mt-transform-image:

 

mt-transform-image(Base64Image as Base64BinaryString, Size as item()+, Rotation as xs:integer, Quality as xs:integer) as Base64BinaryString

The function takes a Base64-encoded image as its first argument and returns a transformed Base64-encoded image. The second, third, and fourth arguments are the image parameters that are transformed: size, rotation, and quality. For a detailed description of the function and usage examples, see the section XPath/XQuery Functions: Image-Related.

 

Note the following points:

 

The input image for the transformation is a Base64-encoded image—not an image file.

Any Exif data in the Base64-encoding will be lost in the transformed image.

If the transformation is done on the client, there could be memory issues on the client. See note below.

 

 

Transformation on client or server

The function mt-transform-image will be executed on the client if not explicitly specified otherwise. This could create memory problems on some clients. When the transformation is started, the image is unpacked from the format of its Base64 encoding to a BMP format, which could be very large. After the transformation is completed, the transformed file is stored back to the original format. The large BMP format could create memory problems on some clients, and you should be aware of this.

 

To avoid the possibility of memory problems on the client, explicitly specify that the transformation must be carried out on the server. Do this with the Execute On action, specifying that the child actions be performed on the server. All the child actions of this Execute On action will then be carried out on the server. You can use an action such as Update Node to update a node with the result of a transformation. The target node will be updated with the transformed image. MobileTogether automatically transfers the results to the client when action handling is complete or when the workflow switches back to the client.

 

 

© 2017-2023 Altova GmbH