Widget Images
Downsamples an image file for a widget. PNG keeps transparency (cutouts); JPEG for photos.
Functions
Link copied to clipboard
actual fun encode(sourcePath: String, format: WidgetImageFormat, maxDimension: Int, maxBytes: Int): EncodedImage?
expect fun encode(sourcePath: String, format: WidgetImageFormat, maxDimension: Int = 512, maxBytes: Int = 2 * 1024 * 1024): EncodedImage?
Long side at most maxDimension, encoding at most maxBytes (shrinks by 3/4 steps down to 128 px). Null when unreadable or impossible.