-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is the text blurred after being translated into pictures? #571
Comments
Are you on a retina machine? If so, you may need to set the Something like: const page = await browser.newPage();
await page.setViewport({width: 800, height: 800, deviceScaleFactor: 2}); By default, puppeteer uses |
Yes, it is the retina screen, the problem is solved, thanks! |
I have a problem with this feature. When you increase the deviceScaleFactor, you also increase the aspect, so the image although becomes sharper, it also becomes bigger. How do you increase quality without scaling up the image? |
This comment was a while ago, but as a lot of people seem to agree with it I wanted to address it. This is just not how images work. If the pixel density of an image doesn't match the device you're viewing it on, it will look blurry. There is no way around this unless you shrink the image to look smaller on your screen to match your pixel density. What you're asking for is impossible. It's basically the same thing as asking for a 1080p video to look like a 4k video on a 4k TV without changing the resolution of the video. That is unless you're just talking about how it appears when you open it on your computer, in which case you could fix this by changing the DPI metadata on the image file. This changes nothing about the data in the image, just how certain devices decide to open them. This can be done with different packages for node or in the browser. |
@csandman is correct, dpi should be bumped. This is what worked for me: sharp(screenshot).withMetadata({ density: 144 }).toBuffer() |
Why is the text blurred after being translated into pictures?
code like this:
The text was updated successfully, but these errors were encountered: