Expo ImageManipulator result file size does not match Expo FileSystem size

64 Views Asked by At

After selecting or taking photo with Expo ImagePicker, and resizing the photo with ImageManipulator, checking this file with FileSystem shows the original size and upon uploading it uploads at original file size.

import * as ImageManipulator from "expo-image-manipulator";
import * as FileSystem from 'expo-file-system'

const image = await ImageManipulator.manipulateAsync(selected[i].uri, [
    { resize: { width: 2000 } }
], { format: ImageManipulator.SaveFormat.JPEG });

Output after manipulation:

{
    "assetId": "...", 
    "base64": null, 
    "duration": null, 
    "exif": null, 
    "fileName": "IMG_1446.jpg", 
    "fileSize": 153297, 
    "height": 2208, 
    "mimeType": "image/jpeg", 
    "type": "image", 
    "uri": "file:///var/mobile/Containers/Data/Application/.../Library/Caches/ExponentExperienceData/.../ImageManipulator/95AB6100-2577-4BC4-B4DA-47D47BCC2BE1.jpg", 
    "width": 1242
}

Output after checking the newly created file with file system.

let info = await FileSystem.getInfoAsync(updated[i].uri);

{
    "exists": true, 
    "isDirectory": false, 
    "md5": "...", 
    "modificationTime": 1707940541.238159, 
    "size": 1154493, 
    "uri": "file:///var/mobile/Containers/Data/Application/.../Library/Caches/ExponentExperienceData/.../ImageManipulator/95AB6100-2577-4BC4-B4DA-47D47BCC2BE1.jpg"
}

The URIs are exactly the same, output after resizing shows small file size, filesystem does not. Is there some sort of caching issue or something I'm missing?

0

There are 0 best solutions below