scale-that-svg
v1.0.6
Published
<p align="center"> <img alt="Scale that SVG!" title="Scale that SVG!" src="https://cdn.rawgit.com/elrumordelaluz/scale-that-svg/880c705b/logo.svg" width="450"> </p>
Downloads
986
Maintainers
Readme
Install
yarn add scale-that-svg
Usage
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 }))
API
scale(input,[options])
input
Type: string|buffer
SVG to scale
options
Type: Object
Based on svg-path-tool scale
scale
Type: number
Default: 1 (no scale)
scaleY
Type: number
If no specified, same as scale
round
Type: number
Default: 3
Related
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
License
MIT © Lionel Tzatzkin