Skip to content

Conversation

@kpfromer
Copy link

@kpfromer kpfromer commented Jan 13, 2021

Description

  • This adds the ?trace parameter for generating SVG image traces using the potrace library.
    • other options should work as well, like resize, width, and height (I have not tested the rest though). By default, svg trace will create a trace of a full-sized image, which is slow. I recommend resizing the image down using resize and width or height.
  • Also optimizes the inline data string for SVGs using mini-svg-data-uri - gatsby-plugin-sharp does this as well. https://webpack.js.org/loaders/url-loader/#svg

This implementation is heavily based on the one used in gatsby-plugin-sharp (seen here)

Images

Example Image:
test

Example Img Component:
image

Trace:
image

Todo

  • How should potrace options be passed? More require query arguments?
  • General note: should images have quality/progressive options?

Thanks again, @cyrilwanner, for making this awesome image tool suite. It's much appreciated!

@kpfromer kpfromer marked this pull request as draft January 13, 2021 20:34
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.

1 participant