mondrian icon indicating copy to clipboard operation
mondrian copied to clipboard

Import PNG

Open MagnaMike opened this issue 11 years ago • 9 comments

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?

MagnaMike avatar Jan 24 '14 20:01 MagnaMike

:+1:

Fishrock123 avatar Jan 24 '14 20:01 Fishrock123

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

artursapek avatar Jan 24 '14 22:01 artursapek

So it won't be too hard to implement?

MagnaMike avatar Jan 25 '14 05:01 MagnaMike

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

jarek-foksa avatar Jan 25 '14 07:01 jarek-foksa

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

MagnaMike avatar Jan 25 '14 17:01 MagnaMike

@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).

jarek-foksa avatar Jan 25 '14 18:01 jarek-foksa

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?

MagnaMike avatar Jan 25 '14 18:01 MagnaMike

Yes.

Fishrock123 avatar Jan 25 '14 18:01 Fishrock123

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.

artursapek avatar Jan 26 '14 01:01 artursapek