Support for the legacy Fitbit Web API ends on September 30, 2026
Important: Support for the legacy Fitbit Web API ends on September 30, 2026. After this date the API will continue to operate, but Google will no longer fix bugs or provide API support. On October 30, 2026, the Fitbit Web API will be turned off and will no longer function or sync data to or from Fitbit users. To continue accessing data for your users after this date, migrate to the Google Health API.
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<ArrayBuffer>

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

Parameter: options Optional parameters for exporting.

Throws: Throws an RangeError exception if the image is too large.

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