optimized-images-loader icon indicating copy to clipboard operation
optimized-images-loader copied to clipboard

feature: add svg traces

Open kpfromer opened this issue 4 years ago • 0 comments

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 avatar Jan 13 '21 20:01 kpfromer