jimp
jimp copied to clipboard
SVG support
Is SVG support planned or was it left out on purpose? Just wondering as I'm looking into dropping node-gm
in favour of a library that does not depend on external binaries.
Jimp is bitmap based so no consideration was given to vector support. What kind of support do you have in mind?
Loading in an SVG, resize it and write it as PNG for example.
That sounds like something that would be in scope. If a pure JS library exists already then certainly we can integrate it.
👍
The only thing I can think of is rendering SVG to
My feeling is that getting this off the ground would be a bigger job than this project has scope for. If anything every gets build be sure I'll integrate it here. But closing for now.
Would love to have SVG support
My feeling is that getting this off the ground would be a bigger job than this project has scope for. If anything every gets build be sure I'll integrate it here. But closing for now.
any interest in adding SVG support for jimp
at this time?
i just started using jimp in a new project, and might be able to contribute a bit once I get a bit more familiar with the jimp API
thank you 😊
It's now 2020 and SVG is one of the most common image formats on the web. It would be nice if this was reopened and reconsidered.
Support depends entirely on finding an SVG library that decodes/encode to/from bitmap data. If this exists support should be easy. If it doesn't then you know why it currently isn't supported
@oliver-moran @hipstersmoothie Any update on SVG support? Because, if there is SVG support we can use open type fonts too
https://www.npmjs.com/package/opentype.js
Would the canvg library be sufficient to be able to import SVG? https://github.com/canvg/canvg
Any update?
I've started a PR #1049 It's very WIP, and could use some input on what the best workflow for handling pre-render transformations is (e.g. what resolution to render it at); since it's a lot different than any other plugin or type provider.
Hi @josh-hemphill
Have you considered using resvg-js instead of canvg? resvg is pretty much the fastest, best supported SVG feature library available, and doesn't require the bloated node-canvas installation.
In some scenarios,resvg-js
is even faster than sharp.
See also https://github.com/RazrFalcon/resvg#svg-support
The reason I went with canvg despite its shortcomings is that it's a pure js implementation as far as I can tell, and since I think jimp is pure js, I figured PRs should try to keep it that way.
I understand your choice, but it looks like it also introduces a non-JS dependency on node-canvas, which often fails to build on my server. node-gyp and postinstall are a terrible experience.
If this is a must-use, I'd suggest skr-canvas (@napi-rs/skia
), which requires no recompilation and is much faster.
Thanks for pointing that out, I didn't realize node-canvas
shipped binaries, I was just following the example implementations that canvg
had listed for Node.js.
I found pureimage
which seems to be a pure js implementation for canvas. It's slower, but for SVG rendering in a non-browser context that's pretty acceptable. I've updated my PR with it. There will probably be some edge cases since pureimage still has a few unsupported canvas features.
Thanks for pointing that out, I didn't realize
node-canvas
shipped binaries, I was just following the example implementations thatcanvg
had listed for Node.js. I foundpureimage
which seems to be a pure js implementation for canvas. It's slower, but for SVG rendering in a non-browser context that's pretty acceptable. I've updated my PR with it. There will probably be some edge cases since pureimage still has a few unsupported canvas features.
I don't have any particular idea about replacing it with pureimage
. Performance aside, if most SVGs are tested to render correctly, then give it a try.
Is the SVG feature integrated into JIMP now? Thanks a lot.
any progress on this? Thanks a lot.