Inkscape.org
Beyond the Basics Disable all bitmaps
  1. #1
    Chameleon Scales Chameleon Scales @Chameleon_Scales
    *

    I have many SVG files containing large images and they take a while to open. I would like to disable bitmaps alltogether so I can open and edit the SVGs as quickly as possible.
    I tried moving all the SVGs in a new folder to break the image links but:

    1. it's not practical in my situation because my SVGs are all contained in separated folders with specific names such that I can't automate moving them back afterwards (at least not easily)
    2. even after moving the SVGs, Inkscape searches far and wide to find the images and fix the broken links, sometimes even finding the wrong ones

     

    So the only solution that would work for me is a setting in Inkscape Preferences or some config file to just turn off all bitmaps so they don't load at all.

    Is there such a thing?

  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    Not sure about disabling.

    If the bitmaps are in a small number of locations (preferably the same directory), I'd consider swapping them for highly compressed versions until the full rez is neeeded.

  3. #3
    Kirstie Kirstie @Kirstie🌷

    Hi Chameleon Scales,

    I've found a setting that can make the bitmaps render blocky, to speed it all up.
    I don't know if that is always faster, or just when importing an image, but you could give it a try.
    Preferences (Ctrl+Shift+P) > bitmaps > import > bitmap scale (image rendering) > blocky (optimize speed).

    And working in the outline mode things will speed up, it hides all bitmaps and filters, but also all colours.
    menu > view > display mode > outline. / Ctrl+5

    ---------

    The easiest way would be to put the bitmaps in their own layers or even selection sets, which you can then hide or show.
    That would take time to edit all your files. Is that something you would consider?

  4. #4
    Chameleon Scales Chameleon Scales @Chameleon_Scales
    *

    Thanks for your help but these solutions are not ideal for me.

    TylerDurden

    If the bitmaps are in a small number of locations (preferably the same directory)

    Unfortunately they aren't and it would be far less practical in my case to join them in the same folder.

    Kirstie

    And working in the outline mode things will speed up

    This doesn't apply in my case since it's not a setting but a view mode, which means it can't be enabled before the file is already open, and my whole problem is opening the files.

    Kirstie

    I've found a setting that can make the bitmaps render blocky, to speed it all up.

    Still not gonna cut it. To give you some perspective, my typical svg contains two 21960x3720 images, four 5000x5000 images and I often have to edit ~50 of those.

    I frequently receive messages from clients asking to change things on ~50 svgs. Whenever possible I just open them in a text editor and replace a piece of svg code by another one with a single Ctrl+H operation but sometimes it's more complicated than that so I have to open them one by one in Inkscape, and if it takes 5 to 10 seconds to open, that's 4 to 8 minutes spent staring at my screen. And sometimes I have to do that multiple times in a day, for several clients.

     

  5. #5
    Kirstie Kirstie @Kirstie🌷

    So that is quite something! No, I am sorry that the solutions won't speed up the workflow enough.
     

  6. #6
    Xav Xav @Xav👹

    I believe you'll need to look outside the box - or, at least, outside the program - for this one. SVG files are plain text, and can be edited by any plain text editing tool, which includes command line scripts. Any linked images will be in the file as self-closing <image ... /> tags. Should that tag be changed to something else, however, Inkscape won't know what to do with it, so won't display the image. But it will still be included in the file if you make other changes and save. Which gives a workflow something like this:

    1. Create a script that replaces the string "<image" with "<Ximage", and a second script that does the opposite.
    2. Run the first script on your files.
    3. Edit the files as needed in Inkscape and save the changes.
    4. Run the second script on the files to change them back into "normal" files.

    Of course, without knowing your OS and level of experience of such things, this approach could be anything from "no problem, that's five minutes work with sed" to "I don't even know where to start with this!".

  7. #7
    brynn brynn @brynn

    Do you mean that the raster images are linked (not embedded) and they still take a long time to load?

    Chameleon_Scales

    even after moving the SVGs, Inkscape searches far and wide to find the images and fix the broken links, sometimes even finding the wrong ones

    That's a new one on me!  I've never heard of Inkscape searching when linked imports' links are broken.  Now I have to test it....  How do you know Inkscape is searching?

    Oh wow!  Yes, Inkscape gives a message:  "Broken links have been changed to point to existing files."  Since it gives that message, it makes me wonder if there's not a way to disable it.  Searching....

    Meanwhile, what about if you put them on their own layer (or layers), and keep the layer hidden?  Does that help?  At least it would save some resources displaying the raster contents, although I guess it still does have to load and/or search.

  8. #8
    brynn brynn @brynn

    Ah-ha!  I found Inkscape Preferences > Bitmap > Edit > Automatically reload bitmaps (wish those developers would stop using that word!!)

    Could that be it?  Testing....

    Meanwhile, at the bottom of that same Preferences page, is an option to render in outline mode.  Might help??

  9. #9
    brynn brynn @brynn

    Hhmm, no dice.  Inkscape found the wrong file this time.  But still tried to find it.  Hhmm....  I wonder what that Automatically Reload Bitmaps means, after all?

    There really ought to be an option not to try to find the image.  At least it seems that way to me.  Certainly could be a requested feature!

    Still thinking on it....

  10. #10
    brynn brynn @brynn

    Oh no, the tooltip on the Automatically Reload Bitmaps option says just what I thought it meant:  "Automatically reload linked images when file is changed on disk"  That would seem to me to mean it is broken - or, a bug.

  11. #11
    Chameleon Scales Chameleon Scales @Chameleon_Scales
    *

    Thanks @Xav, that's certainly the most efficient and simple solution in my situation. (I'm embarrassed I didn't think of it)

    In my case, using Geany with the Mini-Script plugin, these simple sed scripts do it :

    script1:

    s/.jpg/.ajpg/g
    s/.jpeg/.ajpeg/g
    s/.png/.apng/g

    script2 (backwards):

    s/.ajpg/.jpg/g
    s/.ajpeg/.jpeg/g
    s/.apng/.png/g

    Case resolved for me (•̀ᴗ•́)و ̑̑

  12. #12
    Chameleon Scales Chameleon Scales @Chameleon_Scales
    brynn

    "Automatically reload linked images when file is changed on disk"
    That would seem to me to mean it is broken - or, a bug.

    This juts means if you edit your image in say, GIMP and save it, the new image will be updated on Inkscape automatically. I don't think there's any bug here.

  13. #13
    Xav Xav @Xav👹
    Chameleon_Scales

    In my case, using Geany with the Mini-Script plugin, these simple sed scripts do it :

    Glad you got it sorted.

    One thing to be aware of is that a dot is a wildcard character in regular expressions. So instead of

    s/.jpg/.ajpg/g

    you should probably have (backslash before the first dot):

    s/\.jpg/.ajpg/g

    Without this, accidentally running the script against the same file twice would turn '.jpg' into '..ajpg' which would then also require running the second script twice to undo. This is assuming that the mini-script plugin either passes the parameters to the real 'sed', or that the syntax it uses is close enough to also expect a regexp in the search string.

     

    As you seem to be on a Linux box I'll point out that it's not too tricky to turn those sed instructions into a Bash script that takes filenames as its parameters. That would let you change multiple files at once, pass a wildcard to change all the files in a directory, or use 'find' with the -exec parameter to change files across multiple directories. If your workflow already involves loading the files into Geany for some reason then it's probably not worth it, but otherwise it could save you a bit more time - especially when there are a lot of files to work on.

     

  14. #14
    Chameleon Scales Chameleon Scales @Chameleon_Scales

    Thanks again, I'll certainly use this advice 👍