Scale that svg
, period.
yarn add scale-that-svg
const { scale } = require('scale-that-svg')
fs.readFile('./test.svg', (err, input) => {
scale(input, { scale: 0.5 }).then((scaled) => {
console.log({ scaled })
})
})
scale(`<svg viewBox="0 0 500 200">
<rect
x="200"
y="50"
fill="#F16362"
stroke="#30456B"
stroke-width="5"
stroke-linecap="round"
stroke-linejoin="round"
width="100" height="100"/>
</svg>`).then((scaledFromString) => console.log({ scaledFromString }))
Type: string|buffer
SVG to scale
Type: Object
Based on svg-path-tool scale
Type: number
Default: 1 (no scale)
Type: number
If no specified, same as scale
Type: number
Default: 3
element-to-path Convert SVG element into path
path-that-svg Convert entire SVG with path
svg-path-tools Tools to manipulate SVG path
(d)
svgson Transform SVG into Object
MIT © Lionel Tzatzkin