You are here

Backup Working

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
backup_working.scm4.92 KB

This is a simple script I wrote to help make backups when working on a large image.

There are no parameters.

It will save a backup copy of your active image as [imagename-ext]-YYYY-MM-DD-HH-MM.xcfgz in the same directory as your active image.
The script has been modified to allow a limit to the number of backups. The default has been set as 5.
To change this edit line 41 of the script:

(maxbackups 5) ; Change this to define the number of backup files to keep!!!

to whatever you want. Set it to 0 for the old behaviour (no limit)

If the active image has never been saved, it will pop-up a message stating "The file must be saved before a backup can be made."

It can be easily accessed with Alt-F, B

EDIT: Modified to save as compressed files xcfgz.

-Rob A>

Code License: 
GIMP Version: 
Scripting Engine: 



Great utility and great work. It works flawlessly on Windows 7.

However, if it had these two enhancements, it would be utterly indispensable (considering how consistently GIMP locks up/crashes during sessions that meander on for hours ...You know, those hours long "just one more thing" type sessions ;-).

Anyway, here's the idea for the two enhancements:

1) The ability to have to AUTO-backup every X minutes... If this could not be easily user configured (since GUIs are a whole thing to themselves) then just a standard default of every 5 or 10 mins would suffice since generally you only care about the backup after a crash and it only takes about a minute to realized that your very latest work is now dead.

2) Keep only X number of backups... Some gimp files can be rather large and with the addition of item (1) above, this would be especially important... default could be as little as 2 or 3... generally people only want the one a few seconds ago... right before the crash or that last *BIG* mistake... (also, when using cloud storage, too many additional backups chew up storage space).

IMHO, with the above 2 enhancements, I think that this utility would be an *essential* lifesaver for all GIMP fans. Without them it is STILL very useful but honestly not much more useful than hitting CTRL-S to save and using one of the many cloud storage systems that automatically keep a few backups (ie: Dropbox, etc).

For example, what usually threatens my sanity is when I forget to save altogether (and hitting Alt-F, B is not gonna help when I forget to even hit CTRL-S 8-).... You know what I mean... when you're like totally "in the zone" and forget to save and then GIMP crashes... I only then do you realize that it's been HOURS since you last saved.. Then having a few automatic backups from the last 10 minutes would be no less than awesome!

Add those two things and expect the people of the world to bow their heads and shield their eyes from the awesome brightness of your ingenuity...

(okay, that last bit might be a bit of an exaggeration ;-)

Thanks for the feedback @QuestorJones. I've updated the script so it now limits the backups to 5 copies, deleting the oldest ones. Read the description for instructions on changing this number, or setting it back to the old behaviour.

Also, I fixed two bugs:
- would not work on an indexed file
- before it only used the filename, not the extension, so test.jpg and test.xcf would both backup with the same name. I've change the naming to include the original extension. (so it won't erase backups made with the old version....)

-Rob A>

Unfortunately, you can't have a script autobackup every X seconds. It just doesn't work that way. When the script-fu interpreter is called, no other scripts can run until it completes.

There is a backup solution written in python:

but 1) it requires python and 2) I haven't tried it, so YMMV.

I tend to work on large (>100MB) xcf files, which can take a while to save. And while gimp is saving, it is hard to do much else. (i.e. I have some scripts that take 5+ minutes to run that I use often... I wouldn't want an autosave to happen in the middle of that). Maybe I'm a bit of a control freak ;)

Regarding the second, it should be possible...have to think about that...

-Rob A>

I seem to get this error when I try to save the file any ideas:

Execution error for 'Save a Backup':
Error: ( : 32701085) substring: argument 2 must be: non-negative integer

EDIT 24/01/2012 :
Answer my own question you have to save the image as a .xcf file first... then it works fine.


No way, the script doesn't work on my WIN PC.
The message on the script-fu console is:
"> (backup-working run-mode image drawable)
Error: eval: unbound variable: run-mode"

What's this?

Thank you very much for your script, if it would work could have been my safe this morning... :)

I've updated the script to save the backups as compressed xcfgz files instead of regular xcf files.

-Rob A>

Subscribe to Comments for "Backup Working"