Can anyone try this and tell me if they understand what's going on?
Have you compared your output syntax with share/examples/data_uri.svg?
Aha! Adobe Illustrator does this: data:;base64 But, as shown in the sample file, Inkscape wants data:image/png;base64 or data:image/jpg;base64. I've fixed the script to write it the way Inkscape wants it: http://www.lightandmatter.com/embed_raster_in_svg The latest CVS version of Inkscape is now happy with the script's output.
I don't know if AI's output is standards-compliant in this situation or not. Presumably when AI reads one of its own SVG files, it just looks at the magic number from the data in order to figure out what type it is. (There are only two possibilities.) If omitting the type is legal according to the SVG standard, then maybe Inkscape should allow it on input.
P.S. If you plan to keep contributing to Inkscape I can give you developer access
That would be nice, thanks! Given my weak C++ skills and lack of familiarity with Inkscape's codebase, I probably wouldn't dare to committ changes to the C++ code on my own, except maybe after getting comments on them. But if the plan is to have an Extensions menu that can call various Perl scripts, then it might be nice for me to be able to contribute directly to that. My Perl skills are a lot better than my C++ skills, and I'm going to need to write various scripts anyway for my own use (e.g., I'm going to need something to gamma-correct svg files). Is there an API for extensions?