[Android][react-native] incorrect image width and height - CloseableImage getWidth/getHeight
See original GitHub issueDescription
On react native, Image.getSize()
uses Fresco (here) to return the width and height of a given image.
As explaned in this react-native issue (https://github.com/facebook/react-native/issues/22145), the returned width and height are inconsistent in Android. The ratio between width and height is correct, but the values of width and height are not.
Reproduction
See example in https://github.com/facebook/react-native/issues/22145
Additional Information
react: 16.5.0 => 16.5.0 react-native: 0.57.1 => 0.57.1
- Fresco version: com.facebook.fresco:fresco-1.10.0
- Platform version: Android 6.0.1 (One plus One); Android 7.0 (Huawei MediaPad T3 10);
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Expo React-Native getSize() method returns wrong height and ...
I have project where I am trying to get remote image dimensions with getSize() method, problem is that this method ...
Read more >Images - React Native
Images. Static Image Resources. React Native provides a unified way of managing images and other media assets in your Android and iOS apps....
Read more >com.facebook.common.logging.FLog Java Exaples
Get image width and height from jpeg header * @param is the input stream of jpeg image * @return dimensions of the image...
Read more >React Native Get HTTP Remote Image Height Width Size in ...
Image component has inbuilt method known as Image.getSize().Find Online remote server image dimensions in pixels in Image Wallpaper ...
Read more >Java Examples for com.facebook.drawee.drawable.ScalingUtils
setScaleType(scaleType); if (image != null) { debugOverlay.setDimensions(image.getWidth(), image.getHeight()); debugOverlay.setImageSize(image.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you are using Expo, then you can use ImageManipulator.manipulateAsync to flip the image and get the REAL image size. https://docs.expo.io/versions/v36.0.0/sdk/imagemanipulator/
@oprisnik I think you can close this issue, as the downsampling seems to be the cause and the downsampled value is more useful for layout concerns. People are ending up on facebook/react-native#22145 because they want to use
Image.getSize
for image processing after taking an image from a camera. The reason this is even used by people is this bug on thereact-native-camera
repo which returns the captured image size, but with a delay: https://github.com/react-native-community/react-native-camera/issues/768In short IMO, won’t fix on React Native and not a bug for Fresco. Thanks for your help.