GIMP xcf file size reduction

If you are a GIMP user you can end up with plenty of .xcf files.  I do all my editing with xcfs after importing from RAW with the excellent ufraw-gimp plugin.  But they can get pretty big…

Step forward bzip2.  If you are running linux, you will already have bzip installed, and the bonus is that GIMP can read and write natively its xcf files compressed with bzip.  There is a small performance hit on opening and saving files, but you can save 10-40% of file-size; that can easily be 40 MiB for a simple file with a couple of layers.

Of course, disk space is pretty cheap these days, but to my mind there is no point leaving uncompressed files around the place if they are unlikely to be used for a long time. So I run a little cron job to scan my home directory and bzip compress files with an xcf extension which have not been modified for a fortnight or more.

simon@commodus:~$ crontab -e
# m h  dom mon dow   command
05 04 * * * find ~ -name *.xcf -mtime +14 -exec bzip2 {} + > /dev/null 2>&1

This runs the command at 5 minutes past 4 every morning, and compresses any file with a .xcf extension with bzip2, but only if it was last modified more than 14 days ago.  Of course, your PC actually needs to be on at this time (unless you are running anacron or similar) for this to work.