rossmoody / svg-gobbler

Open source browser extension for finding, editing, exporting, optimizing, and managing SVG content.
https://www.svggobbler.com
Apache License 2.0
840 stars 28 forks source link

Make the SVGs exportable as PNG or JPG #11

Closed rossmoody closed 4 years ago

rossmoody commented 5 years ago

Tricky feature. Could default to the size it is in the DOM.

fileformat commented 5 years ago

Ross: Would you consider having an external server do the conversion? I have setup something similar for svgs on my site (example), and could do the same for svg-gobbler. Andrew

rossmoody commented 5 years ago

https://github.com/akveo/eva-icons/blob/master/scripts/helpers/gm-helper.js

fileformat commented 5 years ago

I would recommend librsvg over GraphicsMagick/ImageMagick. There is an npm wrapper for it: https://www.npmjs.com/package/librsvg

It is pretty straightforward with either library, but they all require sending the svg to a server. If this is okay, I can set something up.

jasonrsadler commented 4 years ago

@rossmoody, with above PR, we can use the canvas object to create the file for us.

jasonrsadler commented 4 years ago

@rossmoody, forgot closing keyword on commit 😄

rossmoody commented 4 years ago

TY for the contribution on this one. I backed this one up momentarily until I can think through the usability of it. Being able to export them is awesome, but I found the process of not knowing the size before export to be somewhat frustrating and not a great experience. I think I'd like to implement a way to set the size before export to make this functionality a little more practical.

jasonrsadler commented 4 years ago

Agree. Particularly didn't like having to do https://github.com/rossmoody/svg-gobbler/commit/95ddaf89efcfc2cf573a471678c82d1933762692#diff-15d22cd05123f7d831051296c0e7e7f1R205. I think the functionality themselves would be better suited for a 'dropdown' part of the button (or something similar).

For clarity, is the ask above to allow the user to set whatever size they want prior to downloading?