Image API
chevron down
 

Image API

Variable: Image

An Image that can be transformed and exported to a specific format.

Properties

readonly height

Number

Height of the image, in pixels.

readonly width

Number

Width of the image, in pixels.

Methods

export()

export(format: "image/vnd.fitbit.txi", options?: TxiExportOptions | undefined)

Returns: Promise

Export an image to TXI format. Export an image to JPEG format. Export an image to a given format.

Interface: JpegExportOptions

Options for exporting an image to JPEG

Properties

readonly background

string or undefined

Specifies the background color to alpha-blend with the image. Defaults to black.

readonly quality

number or undefined

Specifies a desired quality level, between 0 and 100, where 0 is the lowest quality, and 100 the highest quality. There is typically a tradeoff between the encoded size and the quality, whereby the higher the quality, the larger the size. This value is subjective and depends on the image content as well as the specific image codec used, so it should not be used as more than a hint to guide the compression algorithm. If not specified, the default quality setting is 85.

Interface: TxiExportOptions

Options for exporting an image to TXI

Properties

readonly background

string or undefined

Specifies the background color to alpha-blend with the image. Defaults to transparent, i.e. no change to alpha.

SourceMimeType

String: string

Extensible list of the MIME types we support Image instance creation from.

Color

String: string

CSS Level 3 color as defined in https://drafts.csswg.org/css-color-3/#colorunits Unsupported exceptions: currentColor