Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
OpenRaster SVG handling #184
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.
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.
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.
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.
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.)
Either way, thanks for taking the time to consider this request.
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.