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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified pngs/resvg/500px.svg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pngs/sharp/500px.svg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions scripts/benchmark/resvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

}).render().asPng()
);