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.

Blurry when used pixelRatio 1 on mobile

See original GitHub issue

Expected Behavior

The downloaded image show have optimum quality like what you see is what you get.

Current Behavior

At a point the image was too small on mobile when downloaded, it didn’t scale up the width and height but small image top left and blank background covers the rest. The solution suggested from a report here was to use pixelRatio to 1 explicitly and it worked but the image is now blurry when downloaded on mobile. Please I need solution to this because it’s affecting production .

Possible Solution

Steps To Reproduce

Error Message & Stack Trace

<!-- Provide a log message if relevant -->

Additional Context

Your Environment

  • html-to-image: [e.g. 0.1.0]
  • OS: [e.g. macOS Sierra 10.12.3]
  • Browser: [e.g. chrome 78.0.3904.108]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
drkPrincecommented, Apr 6, 2021

Try scaling the image size like this,

      
 const style = {
     transform: 'scale('+scale+')',
     'transform-origin': 'top left',
     width: node.offsetWidth + "px",
     height: node.offsetHeight + "px",
 }

 const param = {
    height: node.offsetHeight * scale,
    width: node.offsetWidth * scale,
    style
 }
 
 const blob = await htmlToImage.toPng(node, param)
0reactions
vivcat[bot]commented, Jun 6, 2022

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PIXI game looks blurry on mobile devices - Pixi.js
I can't get Pixi game look crispy on mobile devices. Whenever window.devicePixelRatio is greater than 1, no matter what I do game doesn't ......
Read more >
[SOLVED] UI is blurry on mobile - PlayCanvas Forum
Hello, It doesn't matter if I use 1024px or 128px, my Icons always look blurry on mobile. Enabling Device Pixel Ratio is not...
Read more >
OpenLayers map blurry with pixelRatio = 1
I needed to display raster image tiles served from GeoServer on my OpenLayers 6 map. Using TileWMS(), this was working fine, ...
Read more >
[Xtend] Fix: Blurry screen in HTML5 on mobile (pixel ratio error)
If you find your application appears blurry when running in HTML5 on high-DPI devices (e.g. most modern smartphones), you must configure your ...
Read more >
css - Icons become blurry with viewport and pixel density on ...
Use the -webkit-min-device-pixel-ratio and min-resolution media queries to supply a 58-by-58 pixel image to be used on higher-DPI displays.
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