Preparing search index...

    Module imageResize

    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 through expo-image-manipulator while preserving the original container format.

    import { resizeImageToBound } from '@utils/imageResize';

    const bounded = await resizeImageToBound(cacheUri, 'jpg');
    if (bounded.resized) {
    // bounded.uri points at a new, smaller file in the manipulator cache
    }
    ImageSize
    BoundedImage
    MAX_IMAGE_DIMENSION
    IMAGE_COMPRESSION_QUALITY
    reachesBound
    saveFormatForExtension
    resizeImageToBound