artursapek / mondrian

Web-based vector graphics editor
MIT License
1.24k stars 104 forks source link

Import PNG #3

Open MagnaMike opened 10 years ago

MagnaMike commented 10 years ago

Can you add the ability to import a png image so you draw a vector image based off of the png? For example I have a png, I import it to the background and draw vector shapes over top of it and then save the svg. The png isn't actually part of the final image, I just want to be able to 'trace' it. Does this make sense?

Fishrock123 commented 10 years ago

:+1:

artursapek commented 10 years ago

SVG does support embedding raster images. It's a good idea.

MagnaMike commented 10 years ago

So it won't be too hard to implement?

jarek-foksa commented 10 years ago

You could add support for embedding of PNG files via drag & drop with something like this: https://gist.github.com/jarek-foksa/8613003

MagnaMike commented 10 years ago

Thank you, but sorry, how do I use this?

jarek-foksa commented 10 years ago

@MagnaMike the gist just demonstrates how to use the DOM API in order to implement this functionality, it's not supposed to work out of the box (it's not even CoffeeScript).

MagnaMike commented 10 years ago

Sorry all of this is going over my head, I don't have any real experience to speak of with this kind of stuff. I'll just ask this; is this functionality something you can/will add on in the future?

Fishrock123 commented 10 years ago

Yes.

artursapek commented 10 years ago

It could be done with drag & drop, with an upload field, with a url field...

The input isn't as important as the internal representation class that would have to be written for the <image> element. It will have to extend Monsvg like every other SVG element representation class (see the entire src/geometry directory). That's how Mondrian handles all SVG elements.