RSS/Atom feed Twitter
Site is read-only, email is disabled

Autosave Plugin

This discussion is connected to the mailing list which is provided by the GIMP developers and not related to

This is a read-only list on so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

Autosave Plugin yahvuu 07 Jul 18:06
2009-07-07 18:06:42 UTC (about 15 years ago)

Autosave Plugin

Hi all,

periodical autosave is long standing demand (bug 138373). While in my regard this is headed in a totally wrong direction [1], there's nothing wrong with having a plugin that works this way.

Somewhat suprisingly, i couldn't find such a plugin, so here's some dirty PyGIMP which at first glance seems to do the job. Perhaps someone gets inspired to create something worth uploading to the registry.

Usage: - start GIMP from a terminal (so the script's messages become visible) - toolbox: File->Activate Autosave (activate only once)

Every 30 minutes the script saves backups of all opened images to a temp folder. The backup files won't be deleted when GIMP exits, so some manual clean-up will be required from time to time.

have fun, peter


#!/usr/bin/env python

import tempfile, os from time import *
from gimpfu import *

def autosave(): backupInterval = 30*60

backupFiles = {} print "Autosave activated"

while 1: sleep(backupInterval)

print ctime(time())

curImages = {} for k in gimp.image_list():
curImages[k.ID] = k

curIDs = curImages.keys() oldIDs = backupFiles.keys()

newIDs = [x for x in curIDs if x not in oldIDs]; delIDs = [x for x in oldIDs if x not in curIDs];

# create (empty) backup files for new images for id in newIDs:
prefix = 'gimpbackup-ID' + str(id) + '-' fn = tempfile.mkstemp(prefix = prefix, suffix = '.xcf') os.close(fn[0])
backupFiles[id] = fn[1]

# remove closed images' backups for id in delIDs:
filename = backupFiles[id] del(backupFiles[id])
print "ERROR: ", sys.exc_info()[0]

# backup images for id, filename in backupFiles.iteritems(): img = curImages[id]
print "saving " + + '-' + str(id) + ' to ' + filename pdb.gimp_xcf_save(1, img, img.active_drawable, filename, filename) except:
print "ERROR: ", sys.exc_info()[0]

register( "autosave",
"Autosave dirty hack",
"Periodically saves all opened images to a temp directory", "public domain",
"public domain",
"/File/Activate Autosave",
"RGB*, GRAY*",