react-native-image-resizer
react-native-image-resizer copied to clipboard
[Question] Get output width and height?
Is it possible to get the final width and height of the image after resize?
You can write your own function to do that
import {Image} from "react-native";
export async function getImageDimensions(imageUri) {
return new Promise((resolve, reject) => {
Image.getSize(imageUri, (width, height) => {
resolve({width, height});
}, error => reject(error));
}
);
}
Usage:
const imageDimensions = await getImageDimensions(pathToImage);
You can use this in combination of the image resize function to return both the path to the new image and its dimensions
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed. Thank you for your contributions.