image getting blur issue
See original GitHub issueIs this a bug report or a feature request?
bug report
Have you read the guidelines regarding bug report?
yes
Have you read the documentation in its entirety?
yes
Have you made sure that your issue hasn’t already been reported/solved?
yes
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
Unknown - only able to test on IOS (11.3)
Is the bug reproductible in a production environment (not a debug one)?
Yes
Have you been able to reproduce the bug in the provided example?
I have not tried the demo
Environment
IOS (11.3)
Steps to Reproduce
(Write your steps here:)
- Create a string containing HTML Markup, with an image tag whose src points to a url which is resolved into the images.
Expected Behavior
images should in good result as i upload in ckeditor. should not be blur
Actual Behavior
Image getting blur when i have nested images
Reproducible Demo
i dont have a demo but i have a code
const htmlContent = `
<iframe allow="encrypted-media" allowfullscreen="" frameborder="0" gesture="media" height="163" src="https://www.youtube.com/embed/MST_cBdgqic"></iframe>
<div style="width:100%; height:100%;margin-top:10px; "><img border="0" src="https://storage.googleapis.com/appon/uploadedMedia/54441524224615/54441524224615_up_1524471931.jpg" style="width:100%;" title="" /></div>
<div style="width:100%; height:100%; "><img border="0" src="https://storage.googleapis.com/appon/uploadedMedia/54441524224615/54441524224615_up_1524471931.jpg" style="width:100%;" title="" /></div>
`;
<HTML style={{ marginTop: 15,}} html={itemId.description} imagesMaxWidth={Dimensions.get('window').width} staticContentMaxWidth={Dimensions.get('window'} ignoredStyles={['height','width']} />
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
A Full Guide to Fix blurry photos in 2022 - Wondershare Repairit
1. Motion Blur. Blurriness in photos is caused by multiple reasons; one of them is motion blur. · 2. Holding correctly. Blurred pictures...
Read more >Top 10 Mistakes That Cause Blurry Pictures (And How to Fix ...
Top 10 Mistakes That Cause Blurry Pictures (And How to Fix Them) · 1. Your shutter speed is too slow · 2. Not...
Read more >What to look for when fixing blurry images at 2x - Bootcamp
You will still get a blurry image: Solid background PNG with a 100% width inspected in the browser. Screenshot, taken and edited by...
Read more >8 Reasons Why Your Photos Are Blurry and How To Fix Them
8 Reasons Why Your Photos Are Blurry · 2. Motion Blur ·. Shallow Depth of Field · 4. Missed Focus · 5. Air...
Read more >How to Fix Blurry Pictures and Take Tack Sharp Photos
Problem #1: Camera Shake · Solution: Use a Fast Shutter Speed · Solution: Turn on Image Stabilization · Solution: Use a Tripod ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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
Hello, I had the same issue (only tested on iOS 10 on iPhone 6S). I spent a lot of time aimlessly debugging and I think I figured it out. The problem seems to be something like this:
props.imagesInitialDimensions
tiny dimensions (100x100 by default?).Image.getSize
, the image gets stretched.In other words, if we avoid rendering the image until we know the actual size to render it, it doesn’t get blurred. The following patch (diff for HTMLImage.js) fixes the issue:
I’m not sure if this is a React Native bug or an issue with this library. I’m a React Native noob so I’m not really sure what I’m doing. Shall I submit a PR?
BTW here’s a screenshot of the bug in action, the upper image is given fixed dimensions via style props and the bottom one has its dimensions automatically determined, they are the same size (800x600 real pixels) and imagesMaxWidth is set to 360. After applying this diff to HTMLImage.js this bug no longer occurs
Edit: applied the diff to this fork: https://github.com/guregu/react-native-render-html
Thanks @guregu it worked perfect,
i have also done with little hack, i did edit HTMLimage.js and gave to static height,
but now i am happy with your code