Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Phone API Reference - UI Classes (Widgets) - Image - resize

resize

Description

Changes the size of the image. If either width or height is set to 0, the image will be scaled to the other width/height, maintaining the aspect ratio.

Basic Example: 

Code Block
imageObj.resize(width, height);

Parameters

Name

Required

Type

Default

Description

height

Yes

integer

Height in pixels.

width

Yes

integer

Width in pixels.

Examples

resize an image widget to width of 20 pixels and preserve the previous aspect ratio

Code Block
var testImage = new Image(0, 0, 40, 100);        // image at 0,0 width=40 height = 100
testImage.resize(20, 0);                         // image at 0,0 width=20 height = 50