I was wondering if there is an automatic method to remove unused images that are relatively linked instead of embedded.
For example if I have my .svg file and then I have an image\ folder with images, but in a few months I delete some of the images from the svg file but not from the directory, is there some sort of trick to remove them automatically.
I know about embedding all then extracting all but I have found it can crash when working with a lot of large images.
Automatic method to delete unused images that are linked
-
- Posts: 96
- Joined: Tue Oct 21, 2014 1:40 pm
- Location: Australia
Re: Automatic method to delete unused images that are linked
Do you mean you want a way to delete all the imported/linked images from an SVG file, all at once?
Or do you mean that you want them deleted from your hard drive, when they are deleted from the SVG file?
Or do you mean that you want them deleted from your hard drive, when they are deleted from the SVG file?
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
-
- Posts: 96
- Joined: Tue Oct 21, 2014 1:40 pm
- Location: Australia
Re: Automatic method to delete unused images that are linked
I mean to delete all the images in a folder that are not used in the svg file.
This is when the images in the svg file are linked instead of embedded.
So if I have
design.svg
and then
image1.png
image2.png
image3.png
All imported to the svg file via linking not embedding
but after a while I decide image2.png is obsolete and I delete it in the svg file but not the actual file in the folder, is there an auto trick to do this?
Ie. to tidy up a folder which has images that were once, but no longer used in an svg design.
This is when the images in the svg file are linked instead of embedded.
So if I have
design.svg
and then
image1.png
image2.png
image3.png
All imported to the svg file via linking not embedding
but after a while I decide image2.png is obsolete and I delete it in the svg file but not the actual file in the folder, is there an auto trick to do this?
Ie. to tidy up a folder which has images that were once, but no longer used in an svg design.
Re: Automatic method to delete unused images that are linked
Not that I've ever heard of. You could check with the Extensions Repository http://wiki.inkscape.org/wiki/index.php ... Repository
Maybe this is another one of those "nice to have" extensions? Although to my way of thinking, that's completely outside of Inkscape. Do you know of other graphics programs that will do that kind of thing?
It would have to an optional feature, because not everyone wants an imported image deleted from their hard drive, just because they deleted it from an SVG file.
Maybe this is another one of those "nice to have" extensions? Although to my way of thinking, that's completely outside of Inkscape. Do you know of other graphics programs that will do that kind of thing?
It would have to an optional feature, because not everyone wants an imported image deleted from their hard drive, just because they deleted it from an SVG file.
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Automatic method to delete unused images that are linked
Hi.
What you want can easily be coded in a small python script that;
first scan all your svg files in the directory for embedded images,
scan the directory for images,
delete the ones NOT found in the svg files.
A script like this can be "dangerous" and great care has to be taken to not delete something you might need at a later stage.
The "user" is the "user's" worst enemy. How many have typed "rm" using the wrong wildcard and deleted all files from the hard-drive?
What you want can easily be coded in a small python script that;
first scan all your svg files in the directory for embedded images,
scan the directory for images,
delete the ones NOT found in the svg files.
A script like this can be "dangerous" and great care has to be taken to not delete something you might need at a later stage.
The "user" is the "user's" worst enemy. How many have typed "rm" using the wrong wildcard and deleted all files from the hard-drive?
Last edited by ragstian on Sat Feb 28, 2015 3:13 am, edited 1 time in total.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
-
- Posts: 96
- Joined: Tue Oct 21, 2014 1:40 pm
- Location: Australia
Re: Automatic method to delete unused images that are linked
Ok thanks.
No I didn't expect any program would have this feature.
But it's good to know that it could be done if I could learn scripting for example.
Eventually I might build up 200+ images that were once used in the file but no longer used, in the folder where the linked images are stored. I would still have these saved in an original photos folder somewhere, but they wouldn't be needed in the inkscape linked images folder anymore. Although some could on day in the future, most wouldn't.
Of course if I bought a bluray burner I wouldn't have problems with backing up, even if I did leave all the unused images in the inkscape linked images folder.
Also I'm still designing my workflow.
See I will be taking photos of objects, cutting them out in gimp, import them into inkscape, putting them in front of backdrops individually and in combinations, sharpening them, applying shadow filters then exporting them with the backdrop as images. But often objects become obsolete and need to be removed.
I like to work with fairly high res (although png or tiff lzw compressed) images so I can export to high res print as well as web.
In Xara due to no relative linking and memory limits with 32bit version I had to optimise everything to lower res jpg which excluded using the same file for print (which I rarely if ever do, but might). But it was still very slow with several minutes saving time. So with linked images in inkscape it would be a fraction of a second saving time instead of many minutes, but unused images are not deleted automatically when saving. Although It probably would take a few years before enough unused images accumulated to not fit on a dvd for backup. I could probably just buy a bluray burner in a year or two and never worry about it.
Since unused images won't have any effect on loading time.
No I didn't expect any program would have this feature.
But it's good to know that it could be done if I could learn scripting for example.
Eventually I might build up 200+ images that were once used in the file but no longer used, in the folder where the linked images are stored. I would still have these saved in an original photos folder somewhere, but they wouldn't be needed in the inkscape linked images folder anymore. Although some could on day in the future, most wouldn't.
Of course if I bought a bluray burner I wouldn't have problems with backing up, even if I did leave all the unused images in the inkscape linked images folder.
Also I'm still designing my workflow.
See I will be taking photos of objects, cutting them out in gimp, import them into inkscape, putting them in front of backdrops individually and in combinations, sharpening them, applying shadow filters then exporting them with the backdrop as images. But often objects become obsolete and need to be removed.
I like to work with fairly high res (although png or tiff lzw compressed) images so I can export to high res print as well as web.
In Xara due to no relative linking and memory limits with 32bit version I had to optimise everything to lower res jpg which excluded using the same file for print (which I rarely if ever do, but might). But it was still very slow with several minutes saving time. So with linked images in inkscape it would be a fraction of a second saving time instead of many minutes, but unused images are not deleted automatically when saving. Although It probably would take a few years before enough unused images accumulated to not fit on a dvd for backup. I could probably just buy a bluray burner in a year or two and never worry about it.
