Image manipulation API

Official Content
This documentation is valid for:

The task of image manipulation is quite common in Smart Devices applications. Common actions include: resizing, scaling, rotating, cropping, flipping horizontally and vertically, etc.

To allow the performance of such actions on images, GeneXus has added certain functions to the Image data type.

Warning: Only available for the iOS generator as of GeneXus 16 upgrade 2.

Properties

ImageWidth: Numeric

Read-only property. Returns the image width in pixels.

&width = &image.ImageWidth

 

ImageHeight: Numeric

Read-only property. Returns the image height in pixels.

&height = &image.ImageHeight

 

FileSize: Numeric

Read-only property. Returns the image's file size in bytes.

&fileSize = &image.FileSize

 

Methods

Resize

Returns a new image by resizing the original image.

Parameters:

  • Width: Numeric - width of the new image,
  • Height: Numeric - height of the new image,
  • KeepAspect: Boolean, if set to True, then the image is resized using "fill keeping aspect". Otherwise, it uses "fill".
&resizedImage = &image.Resize(100, 100, true)

Scale

Returns a new image by scaling the original image in the specified percentage.

Parameters:

  • Percentage: Numeric.
&scaledImage = &image.Scale(80)

Rotate

Returns a new image by rotating the original image in the specified angle. Valid angles are 90, 180 and 270 degrees; other values are ignored.

Parameters:

  • Angle: Numeric.
&rotatedImage = &image.Rotate(90)

Crop

Returns a new image by cropping the original image. The dimensions of the new image are determined from the square indicated by the parameters.

Parameters:

  • Left: Numeric - left coordinate in pixels where the cropping begins.
  • Top: Numeric - top coordinate in pixels where the cropping begins.
  • Width: Numeric - width of the new image in pixels.
  • Height: Numeric - height of the new image in pixels.
&croppedImage = &image.Crop(0, 0, 50, 50)

FlipHorizontally

Flips the image horizontally.

&hFlippedImage = &image.FlipHorizontally()

FlipVertically

Flips the image vertically.

&vFlippedImage = &image.FlipVertically()

Availability 

These properties and methods are available as of GeneXus 16 upgrade 2.

Scope

Platforms SmartDevices(iOS)

 

See also 

Image data type