ImageManipulator uri is returning original image uri

#1

Here’s our ImageManipulator code (Using Expo SDK 26)

let main = await ImageManipulator.manipulate(
                                uri,
                                [{ width: 1024, height: 1024 }],
                                {
                                    compress: 1,
                                    format: 'jpeg'
                                }
                            )

                            let thumb = await ImageManipulator.manipulate(
                                uri,
                                [{ width: 128, height: 128 }],
                                {
                                    compress: 1,
                                    format: 'jpeg'
                                }
                            )

                            const profilePicture = {
                                fullsized: main.uri,
                                thumbnail: thumb.uri
                            }

When we send the profile pictures to our server, we get two images of the original size, with no compression done. Instead of an image of size 128x128 and 1024x1024.

Yes, we’re sending profilePicture.fullsized to our API and not the uri from the ImagePicker.

Note that using the Base64 information from the ImageManipulator shows the correct image after resizing.

0 Likes

#2

To resize images you have to pass an object with key resize so your invocation should look like this:

await ImageManipulator.manipulate(
                                uri,
                                [ { resize: { width: 1024, height: 1024 } } ],
                                {
                                    compress: 1,
                                    format: 'jpeg'
                                }
                            );
0 Likes

closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

0 Likes