I am using inkscape to design figures for academic publications. Specifically, I create plots programmatically outside inkscape and save these as individual svg files ranging from a few hundred KB to 2-3 MB depending on the amount of data points in the figure. I import these plots into inkscape and use the arrange and align tools to design the figure layout.
My issue is that performance suffers if I embed the svgs to the point where inkscape becomes unusable (I have tried the performance tips mentioned on the inkscape website, including using hidden layers, outline view, and simplifying paths, but performance is still subpar). Inserting a bitmap with a link to the original file is working much better performance-wise and also reduces the svg file size. However, when exporting (via "save a copy") documents with linked files, inkscape uses the bitmap rendition rather than the svg file the link is pointing to, which means that the resolution of the exported file is not as good as it could be and the file size becomes much bigger since I need to use around 400-500 DPI on the bitmaps for reasonable resolution.
It would be great if there was an option to link a file and use the bitmap rendition to layout object inside inkscape for best performance, and then when exporting to vector formats use the vector files that the links are pointing to for small file sizes and great resolution. Is this currently possible in inkscape and I am just missing how to do it? Or is there an obvious hurdles to why this will not work? Otherwise I might suggest it as a feature request on GitLab.
Related, is there a way to change the bitmap DPI after importing/linking an svg, or do I need to reimport the file?
Related, is there a way to change the bitmap DPI after importing/linking an svg, or do I need to reimport the file?
If a bitmap is linked in the active svg file, a lower/higher rez bitmap with the same filename & location can be substituted. Is that what you are asking, or something more complex?
It would be great if there was an option to link a file and use the bitmap rendition to layout object inside inkscape for best performance, and then when exporting to vector formats use the vector files that the links are pointing to for small file sizes and great resolution. Is this currently possible in inkscape and I am just missing how to do it?
Seems possible, I would need to try it to see if it can work similar to above.
Great, thank you @Aero I missed that somehow. This gives me hope I have also missed a way to achieve the rest of my question! Do you know if there it is possible to change in batch somehow? When I select multiple linked svgs/images, the Object properties are all greyed out.
If a bitmap is linked in the active svg file, a lower/higher rez bitmap with the same filename & location can be substituted. Is that what you are asking, or something more complex?
@TylerDurden I was referring to what Aero mentioned above.
Do you know if there it is possible to change in batch somehow? When I select multiple linked svgs/images, the Object properties are all greyed out.
For this I figured out that I can just use a text-editor to search and replace in the svg file, which works great.
For my main question, I want to add that I would also be interested in a programmatic solution. For example, I could imagine a script that parses the svg file and replaces each <image> tag with the embed content of the svg file it links to. Then I could use make to automate the parsing of the svgs when exporting. I would still very much appreciate if there was a simpler solution, like enabling a command like flag when exporting, something like inkscape --embed-linked-files --export-type=pdf myfile.svg.
@joelostblom have you ever managed to write any script that would embed .svg links? I'm struggling currently to use them when they get rasterized on PDF export.
@7jfosqo5 Hmm, I don't think I every wrote a script for this and instead included a higher resolution bitmap or embedded the svg instead of linking to it. It was a while ago though, so I don't quite remember if that was the solution. I agree with you that the lack of this functionality makes them harder to use. You can upvote/comment on this feature request if you would like to add to the discussion / vote for it to be included https://gitlab.com/inkscape/inbox/-/issues/3165
@joelostblom thanks, I've upvoted that request already, hopefully it will get some more attention. My current workaround is not to use inkscape links, but simply group elements that are to be linked to other documents and... copy them manually :) Not very innovative, I know, but I can see this getting automated fairly easily in the future and in effect creating kind of like a link feature. Probably create a simple command line function to swap/update them as well. I think that would make it also easy to "unlink" a group simply by ungrouping it (which depending on a task may be a fairly frequent operation).
That's really what I expected links to be in inkscape. It's not that complicated.
I am using inkscape to design figures for academic publications. Specifically, I create plots programmatically outside inkscape and save these as individual svg files ranging from a few hundred KB to 2-3 MB depending on the amount of data points in the figure. I import these plots into inkscape and use the arrange and align tools to design the figure layout.
My issue is that performance suffers if I embed the svgs to the point where inkscape becomes unusable (I have tried the performance tips mentioned on the inkscape website, including using hidden layers, outline view, and simplifying paths, but performance is still subpar). Inserting a bitmap with a link to the original file is working much better performance-wise and also reduces the svg file size. However, when exporting (via "save a copy") documents with linked files, inkscape uses the bitmap rendition rather than the svg file the link is pointing to, which means that the resolution of the exported file is not as good as it could be and the file size becomes much bigger since I need to use around 400-500 DPI on the bitmaps for reasonable resolution.
It would be great if there was an option to link a file and use the bitmap rendition to layout object inside inkscape for best performance, and then when exporting to vector formats use the vector files that the links are pointing to for small file sizes and great resolution. Is this currently possible in inkscape and I am just missing how to do it? Or is there an obvious hurdles to why this will not work? Otherwise I might suggest it as a feature request on GitLab.
Related, is there a way to change the bitmap DPI after importing/linking an svg, or do I need to reimport the file?
If a bitmap is linked in the active svg file, a lower/higher rez bitmap with the same filename & location can be substituted. Is that what you are asking, or something more complex?
Seems possible, I would need to try it to see if it can work similar to above.
Yes, in Object properties.
Thanks both for the replies!
Great, thank you @Aero I missed that somehow. This gives me hope I have also missed a way to achieve the rest of my question! Do you know if there it is possible to change in batch somehow? When I select multiple linked svgs/images, the Object properties are all greyed out.
@TylerDurden I was referring to what Aero mentioned above.
Encouraging, this would be really great! Let me know what you find!
For this I figured out that I can just use a text-editor to search and replace in the svg file, which works great.
For my main question, I want to add that I would also be interested in a programmatic solution. For example, I could imagine a script that parses the svg file and replaces each <image> tag with the embed content of the svg file it links to. Then I could use
make
to automate the parsing of the svgs when exporting. I would still very much appreciate if there was a simpler solution, like enabling a command like flag when exporting, something likeinkscape --embed-linked-files --export-type=pdf myfile.svg
.@joelostblom have you ever managed to write any script that would embed .svg links? I'm struggling currently to use them when they get rasterized on PDF export.
@7jfosqo5 Hmm, I don't think I every wrote a script for this and instead included a higher resolution bitmap or embedded the svg instead of linking to it. It was a while ago though, so I don't quite remember if that was the solution. I agree with you that the lack of this functionality makes them harder to use. You can upvote/comment on this feature request if you would like to add to the discussion / vote for it to be included https://gitlab.com/inkscape/inbox/-/issues/3165
@joelostblom thanks, I've upvoted that request already, hopefully it will get some more attention. My current workaround is not to use inkscape links, but simply group elements that are to be linked to other documents and... copy them manually :) Not very innovative, I know, but I can see this getting automated fairly easily in the future and in effect creating kind of like a link feature. Probably create a simple command line function to swap/update them as well. I think that would make it also easy to "unlink" a group simply by ungrouping it (which depending on a task may be a fairly frequent operation).
That's really what I expected links to be in inkscape. It's not that complicated.