Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IImage

interface IImage
Extends com.amazon.apmf.IStandard IImage represents a decoded image in memory that can be drawn, transformed, manipulated or encoded. It holds pixel data in a format optimized for rendering and transformation. Images are immutable so operations like resize create new image instances rather than modifying existing ones. This interface provides APIs to query the image size, perform high-quality resizing using filters and encode the image into various output formats.

Methods

getSize()

SizeI getSize()
Gets the SizeI of IImage.

Returns

SizeI SizeI representing the width and height of the image.

resize()

IImage* resize(SizeI targetSize, ImageFilterQuality filterQuality)
Creates a new image by scaling this image to the specified dimensions. Image scaling is done using the specified sampling quality. The aspect ratio of the image is not preserved automatically and the image will be stretched to exactly match the target dimensions.

Parameters

targetSize
SizeI — Required Desired width and height of the new image after resizing
filterQuality
ImageFilterQuality — Required Sampling quality for the scaling operation

Returns

IImage* A new image with the specified dimensions

Throws


encode()

u8[] encode(EncodedImageFormat imageFormat)
Encodes this image’s pixels into the specified format. It supports common image formats with these characteristics:
  • JPEG: Lossy compression, best for photos No alpha channel support File size depends on image complexity
  • PNG: Lossless compression, best for graphics Supports alpha channel File size depends on image complexity
  • WebP: Modern format with both lossy and lossless modes Typically smaller than JPEG/PNG Supports alpha channel
Encoding time depends on the format chosen and image size:
  • JPEG is typically fastest
  • PNG may be slow for complex images
  • WebP encoding is slower but produces smaller files

Parameters

imageFormat
EncodedImageFormat — Required The desired image format for encoding.

Returns

u8[] Encoded image data in the specified format in the form of a byte array

Throws


Last modified on October 29, 2026