question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recently had an issue with images exporting and looking incredibly blurry.

Looking at the html2canvas logs I saw the x position and crop position were returning as 174.5. This half a pixel was causing the images to render with an excessive amount of blur.

To force this to stop (as I couldn’t think of a reason this would be the desired outcome) I have added Math.floor() to the top, bottom, right, left positions. (I did not have any issues with width and height.).

    function getBounds (node) {
        if (node.getBoundingClientRect) {
            var clientRect = node.getBoundingClientRect();
            var width = node.offsetWidth == null ? clientRect.width : node.offsetWidth;
            return {
                top   : Math.floor(clientRect.top),
                bottom: Math.floor(clientRect.bottom || (clientRect.top + clientRect.height)),
                right : Math.floor(clientRect.left + width),
                left  : Math.floor(clientRect.left),
                width : width,
                height: node.offsetHeight == null ? clientRect.height : node.offsetHeight
            };
        }
        return {};
    }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:15
  • Comments:29 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
CKGraficocommented, Jun 28, 2017

And after two years they don’t have found anything better ?? 👏

3reactions
benzara-taharcommented, Aug 29, 2021

I used this and it fixed the issue html2canvas(domElement, { scale: 2 });

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unblur Images: Free Online Image Deblurring Tool - Fotor
You can now fix blurry images in just one click with Fotor's image deblurring tool! Powered by artificial intelligence, Fotor will analyze and...
Read more >
Sharpen image online - PineTools
Sharpen an image. ... Blurred frame images generator · Take a screenshot · Bulk add noise · Bulk blur image · Bulk blurred...
Read more >
3 Easy Ways to Make Blurry Image Clear and Sharp
Blurry photos are an eyesore, and one of the fastest ways to fix them is with Let's Enhance. Its neural nets will sharpen...
Read more >
How to Fix Blurry Pictures: 3 Ways - MakeUseOf
2. How to Fix Blurry Pictures With Fotor (Browser) · Go to the Fotor website, and from the Get a Quick Start tab,...
Read more >
Unblur & Sharpen Image Online 100% Free - PicWish
How to sharpen image in PicWish Photo Editor? ... Upload a blurry photo file from your photo library. ... Reduce blurring automatically in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found