react-native-image-zoom icon indicating copy to clipboard operation
react-native-image-zoom copied to clipboard

Possible to retain the quality of the image when zooming?

Open codeplaygoa opened this issue 5 years ago • 17 comments

I have image with small text in it. The image itself is hd so normally on zooming the text can be readable. But with react-native-image-zoom the image is scaled from the mentioned dimension of the Image component. Is it possible to zoom first to the maximum size of the original image and then starts scaling? Here you can see the text is getting blurred as you zoom https://snack.expo.io/rylljGstV

codeplaygoa avatar Apr 10 '19 07:04 codeplaygoa

+1

augustofontes avatar Apr 29 '19 15:04 augustofontes

+1

asasouza avatar May 10 '19 15:05 asasouza

+1

VadimCpp avatar May 20 '19 18:05 VadimCpp

+1 I have the same problem.

LeoUrushi avatar May 24 '19 12:05 LeoUrushi

@ascoders same issue. +1

harry-harish avatar Jun 10 '19 16:06 harry-harish

+1

philyboysmith avatar Jun 28 '19 12:06 philyboysmith

It looks like iOS version does decent job in retaining image quality. But on Android, it gets very blurry.

LeoUrushi avatar Jun 28 '19 13:06 LeoUrushi

+1

sajjadintel avatar Aug 30 '19 18:08 sajjadintel

+1

torchsmith avatar Jan 20 '20 20:01 torchsmith

is there a fix for this issue? or you guys found another image zoom library?

johnlim5847 avatar Apr 17 '20 09:04 johnlim5847

Facing the same exact issue, we cant figure out how to apply a workaround for this.

deprolou avatar May 15 '20 14:05 deprolou

@ArtemKolichenkov Thanks for your hard work on the latest release! May I know will this issue be fixed in the upcoming release?

johnlim5847 avatar May 20 '20 04:05 johnlim5847

@johnlim5847 I will work on this issue today. Hopefully will find the solution quickly 😅

ArtemKolichenkov avatar May 20 '20 08:05 ArtemKolichenkov

So I'm just gonna dump my findings here:

  • This is likely related mostly to .png images.
  • It was already like this couple of years ago in RN 0.57 (https://github.com/facebook/react-native/issues/21301)
  • This issues goes deeper into RN dependency Fresco (https://github.com/facebook/fresco/issues/2397). There is some PR there but idk if/when its gonna be merged/tested.
  • maybe https://github.com/DylanVann/react-native-fast-image can solve the issue. We might try using that, although I need to check if that would be backwards-compatible and if it will actually solve the issue. They started supporting bundled assets so there shouldn't be any drawbacks from using them, although I need to check. (This seems like breaking change though the more I think about so eh.... idk).
  • here's StackOverflow question about this issue.

ArtemKolichenkov avatar May 20 '20 11:05 ArtemKolichenkov

After being stuck with this problem for some time I ended up finding a workaround that solved the quality problem for Android in my case. My solution was to get the current scale from the react-native-image-zoom through the onMove({scale}) method and multiply the height and width values ​​of my image. Here's an example:

<ImageZoom 
        enableDoubleClickZoom={false}           
        onMove={this.onMoveZoom}
        cropWidth={cropWidth}
        cropHeight={cropHeight}
         imageWidth={cropWidth * this.state.currentScale}
         imageHeight={cropHeight * this.state.currentScale}>
            <Image 
               style={{
                  width: cropWidth * this.state.currentScale, 
                  height: cropHeight * this.state.currentScale, 
               }}
               source={{uri: YOUR_URI}} 
               resizeMode="contain"/>
</ImageZoom>

I hope this helps.

queizy-sartori avatar May 22 '20 20:05 queizy-sartori

check out this zoomable image component on stackoverflow could be helpful https://stackoverflow.com/a/37449923/11838322

mohamedosamakj avatar Jul 16 '20 11:07 mohamedosamakj

Still no solution in 2021 with latest and increasing size does not work, nor does FastImage

evanjmg avatar Jun 22 '21 14:06 evanjmg