Reputation: 335
I want to compress image using expo-image-manipulator
. I followed documentation Expo-ImageManipulator. Everything seems fine but i get "Cannot read property 'ExpoImageManipulator' of undefined". Have you ever faced this error?
import { manipulateAsync } from "expo-image-manipulator";
const manipResult = async (imageUri) =>
await manipulateAsync(
imageUri,
[{ resize: { width: 640, height: 480 } }],
);
Upvotes: 0
Views: 733
Reputation: 1
import * as ImageManipulator from "expo-image-manipulator";
Importing your ImageManipulator
like this worked for me.
And also check if you have correct version of ImageManipulator
for your sdk
Upvotes: 0
Reputation: 376
Sorry, i don't have an enough reputation so can't do comment, only answer... Did you try do their examples with all params for manipulateAsunc?
const _rotate90andFlip = async () => {
const manipResult = await manipulateAsync(
image.localUri || image.uri, // maybe you don't have this value
[
{ rotate: 90 },
{ flip: FlipType.Vertical },
],
{ compress: 1, format: SaveFormat.PNG } // or need add this
);
setImage(manipResult);
};
Upvotes: 1