Roughsketch / imagesize

Quickly probe the size of various image formats without reading the entire file.
MIT License
57 stars 12 forks source link

Support for SVG images? #16

Closed LukasKalbertodt closed 2 years ago

LukasKalbertodt commented 2 years ago

Hi there! Great crate idea, I love the idea of a minimal crate for just this purpose.

Unfortunately, I also need to work with SVG images. Of course, the size of a vector graphic is something quite different from raster graphics. (In my specific case I only care about the aspect ratio of the images.) I'm not even sure if there is a clear and useful definition of what this crate could return for an SVG file. The canvas size? The view box? How does this all work? I don't know!

I just wanted to open this issue to get input on this and see if it would be a useful addition to this crate. Of course, maybe there is no clear useful definition OR determining the canvas size is super complex. Then of course, it's not a good fit for this crate.

Roughsketch commented 2 years ago

I looked at some SVG examples and I don't think this is something I can add into this crate without adding a ton of complexity. Some SVG examples have a width and height field (although these are floats which messes with things already), but other SVGs have no mention of a width or height field and it's probably determined some other way. I really don't want to add an SVG renderer into here just to support it, so I want to say no to this for now.

If you can find some info on how to do this in a clean way I can reconsider though.