Recipe photos come from the camera (8-48MP) or from scraped websites at
whatever resolution the site serves. Persisting them verbatim makes every
list tile decode a multi-megapixel bitmap into a ~200px view, which causes
frame drops and bitmap-cache churn once a library grows past a few hundred
recipes.
These helpers cap the longest side of an image at MAX_IMAGE_DIMENSION
before it reaches permanent storage. The source is decoded once, directly at
the reduced size, through expo-image (ImageIO thumbnail decode on iOS, Glide
downsampling on Android), then re-encoded through expo-image-manipulator
while preserving the original container format.
constbounded = awaitresizeImageToBound(cacheUri, 'jpg'); if (bounded.resized) { // bounded.uri points at a new, smaller file in the manipulator cache }
imageResize - Bounded image downscaling helpers
Recipe photos come from the camera (8-48MP) or from scraped websites at whatever resolution the site serves. Persisting them verbatim makes every list tile decode a multi-megapixel bitmap into a ~200px view, which causes frame drops and bitmap-cache churn once a library grows past a few hundred recipes.
These helpers cap the longest side of an image at MAX_IMAGE_DIMENSION before it reaches permanent storage. The source is decoded once, directly at the reduced size, through
expo-image(ImageIO thumbnail decode on iOS, Glide downsampling on Android), then re-encoded throughexpo-image-manipulatorwhile preserving the original container format.Example