OpenRaster SVG handling #184

horkana opened this Issue Apr 8, 2015 · 3 comments


None yet

2 participants

horkana commented Apr 8, 2015

MyPaint 1.1.1 (precursor to version 1.2 their next significant release) includes a feature called Vector Layers. Drawpile rejects files that contain this feature.

Essentially they have extended the OpenRaster format and in addition to layers in PNG format they are also including layers in SVG format.
Drawpile 0.99 gives an error saying cannot open layer.svg, and the file is not loaded (so if one layer is in an unknown format, none of the other layers get loaded).

It would be great if drawpile could load OpenRaster files containing SVG files like these (even if the SVG is immediately to PNG, If it was possible to pass through the SVG that would be even better but it is of course up to you how you choose to implement it, if at all).

Maybe I should submit a separate request but there is a second thing I'd like you to consider. If someone doing testing created an OpenRaster file that did not contain a mimetype file or had a mimetype file with a different value Drawpile immediately rejects the file as invalid.
It is great that you actually test to see if there is a mimetype file, many other implementations don't test it at all. What I'd like you to consider is issuing a warning and only failing if stack.xml is not found. (I've modified some code to generate files that contain both OpenRaster stack.xml and OpenDocument content.xml and it would be nice if these files were not rejected.)

Generally this all fits under a bigger idea that OpenRaster will change in future and if you were able to change the import code to be slightly more forgiving when things don't work exactly as expected that would help make it easier to keep back compatibility.

@callaa callaa added a commit that referenced this issue Apr 8, 2015
@callaa Don't assume ORA layers are PNGs
Let QImage autodetect the format.
Issue #184
callaa commented Apr 8, 2015

I made a small change to let QImage autodetect the layer file format. Since SVG is supported by Qt (and it is used for icons all over Drawpile), this should be enough to enable SVG layer support. The layers are converted to raster format and will be saved as such, though. I should probably add a warning for this.

As for the mimetype check, this is one of the few files required by the specification. All conforming implementations should put it there and I doubt it will ever change.

horkana commented Apr 8, 2015

Thanks for the SVG change. Sounds great.

As for mimetype that is a valid choice, it is required by specification, I suppose that is fair.

For what it is worth though I can provide a comparison to OpenDocument and LibreOffice. If the mimetype is completely missing but the file is otherwise valid it loads without any error message. If the mimetype file contains the wrong information (like it did in my hybrid OpenRaster/OpenDocument test files) but the file is otherwise valid LibreOffice gives an error message about the mimetype being incorrect but attempts to open the file anyway. (The minimal requirements of the OpenDocument specification is for mimetype content.xml and a valid manifest.)
I suppose if the mimetype ever changes in future the code can be changed but as I said I'd prefer if the import code was just a little more forgiving and only rejected the file if both stack.xml AND mimetype are wrong or missing.

Either way, thanks for taking the time to consider this request.
(I also like the work you've done to include Text support in OpenRaster.)

callaa commented Apr 8, 2015

I would imagine that if the mimetype is ever changed, the stack.xml format will have changed drastically as well and would require updates anyway.

Hopefully proper text layers will be included in the standard one day. The Drawpile specific extension I'm using now is quite limited, being just a rectangle with HTML inside, but something simple like it would be nice to have as a standard.

I haven't tried out the new MyPaint yet, but will once it's released. Meanwhile, if you spot any problems with the SVG support, feel free to reopen this issue.

@callaa callaa closed this Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment