Skip to main content
Skip table of contents

resizeImage

A logic command for reducing the size of an image File.  

While a large image can easily be scaled to look smaller on a document, the data behind the image is still that of a large image, increasing the document's file size. Large images may also slow down the evaluation of commands using them. This command makes it possible to resize an excessively large image to the size it is actually needed at, thereby increasing performance and reducing the file size of the result document. 

Attributes

value

Required

Value type

EL-evaluated

Yes

File

Yes

Defines the image that will be resized. The resolved value is expected to be an image File of PNG, GIF, JPEG or BMP format.

var

Required

Value type

EL-evaluated

No

String

No

Defines the name of a variable holding the resized image File.

If not defined, the File to be resized will become the resized File and no new variable is created.

height

Required

Value type

EL-evaluated

No

String, Number

Yes

Defines a new height for the image. The resolved value can define the height in two ways:

  • A Number or a number-like String, e.g. "255", will define the height in pixels.

  • A String that is a number followed by a percent sign, e.g. "33%", will define the height relative to the image's original height.

If the defined height value is higher than the original height of the image, the height is set to that original height.

Either this attribute or width must have a defined value. Otherwise the command cannot define the image's new dimensions and an error is produced.

If not defined, the image's new height is calculated based on the resolved value of width so that the resize process will not change the image's original aspect ratio.

width

Required

Value type

EL-evaluated

No

String, Number

Yes

Defines a new width for the image. The resolved value can define the width in two ways:

  • A Number or a number-like String, e.g. "255", will define the width in pixels.

  • A String that is a number followed by a percent sign, e.g. "33%", will define the width relative to the image's original width.

If the defined width value is higher than the original width of the image, the width is set to that original width.

Either this attribute or height must have a defined value. Otherwise the command cannot define the image's new dimensions and an error is produced.

If not defined, the image's new width is calculated based on the resolved value of height so that the resize process will not change the image's original aspect ratio.

Examples

Unlike many other commands with the var attribute, resizeImage doesn't actually require a value for it - in fact, it is better to leave it undefined in case your logic has no need for the image in its original size. Doing so modifies the image File value that is being resized so that it itself becomes the resized image. At minimum resizeImage therefore needs two attributes defined, value and either width or height. The following causes the File variable "image" to become 50% smaller in both height and width:

CODE
<resizeImage value="${image}" height="50%">

Leaving either height or width undefined is an easy way to resize the image without affecting its aspect ratio.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.