Skip to content
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

fix: use the correct resvg-js parameters to avoid PNG jaggies #1

Closed
wants to merge 1 commit into from

Conversation

yisibl
Copy link

@yisibl yisibl commented Aug 11, 2022

In resvg-js, only need to enter the final desired width or height via the fitTo parameter.

@@ -6,13 +6,9 @@ export default svg => (
loadSystemFonts: false,
},
logLevel: 'off',
imageRendering: 1,
textRendering: 0,
shapeRendering: 0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping these values would help speed up the process.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change the rendering result of the PNG

fitTo: {
mode: 'width',
value: 800,
},
dpi: 2400,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I make resvg-js set the output DPI to 2400?

Seems adding this back doesn't really make a difference. The resulting DPI is still 72.

resvg-js

Screen Shot 2022-08-11 at 1 09 55 AM

sharp

Screen Shot 2022-08-11 at 1 10 16 AM

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yisibl yisibl closed this Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants