Using G'MIC Film Emulation Filters Offline

I’ve had a few questions regarding using the Film Emulation presets I put together with the G’MIC team. Specifically, how to use the emulations while offline. So I figured I would offer some suggestions on how to make this possible at the moment.

Well, David Tschumperlé already fixed this (within a couple of hours of publishing this post, no less). I’m leaving it here for posterity, though. Thanks David!

The way it currently works is, there is a file for each film emulation type. When you choose one to preview in G’MIC, behind the scenes it will go and download the file to your local temporary directory (where this is depends on your OS).

Now, this is fine for the most part. Unless you don’t have a constant internet connection, or a fast one. Then it becomes a bit of a problem. The reason is that sometimes the contents of the temporary directory might be wiped out on a reboot, which means you’d have to re-download all of the emulation files again.

So here’s a way to get around this problem.

I’m going to show this in Windows 7, as I don’t have a linux box nearby to test this on at the moment. See below for notes on linux use.

To begin, you’ll actually need to get some of the .cimgz emulation files. The easiest way to do this is to actually use G’MIC to preview the effect on an image.

Open an image, open G’MIC:

Filters → G’MIC

and go to:

Film emulation

Pick a few to preview. If you’ve never used the type before, you’ll notice a slight lag while G’MIC downloads the .cimgz file in the background, then applies it. When you’ve cycled through a few different emulation types, you’re done.

Now you will have the .cimgz files on your computer somewhere. In my example (Windows 7), the files are stored in a temporary directory in the %APPDATA% directory. In my case they are here:

C:\Users\{USERNAME}\AppData\Local\Temp

So what I want to do is to move all of the .cimgz files to a more permanent place. To make things simple, I just moved up one directory and created a new folder that I called “gmic-film-presets”:

C:\Users\{USERNAME}\AppData\Local\gmic-film-presets

I then just moved all of the gmic*.cimgz files into that folder.

Ok, a little trial and error led me to this solution. It turns out you can’t just use a shortcut to the files. G’MIC will still download the files if you do. The solution is to use a proper symlink (which wasn’t available until Vista, I believe). A symlink is just a reference to a file somewhere else on your filesystem (linux users should already be aware of them).

It’s sort of like a shortcut, but it’s not. :)

The only caveat is that you’ll need to perform this next step as an administrator on your machine.

Basically, we are going to create symbolic links from our actual files (in the “gmic-film-presets” directory) to the “Temp” directory.

To do this, we’ll need a windows command line, run as administrator. So click on the “Start” button, and in the search box, type in “cmd”. Right-Click on the “cmd.exe” that comes up, and choose “Run as administrator”.

Once you have a command window, just navigate to the Temp directory:

cd C:\Users\{USERNAME}\AppData\Local\Temp

Ok, the actual command for creating a symbolic link is:

mklink {LINK-NAME} {SOURCE}

For example, if I wanted to link a single file from my new directory, into Temp, I would use this command (from the Temp directory):

mklink gmic_rollei_retro_80s.cimgz ..\gmic-film-presets\gmic_rollei_retro_80s.cimgz

This will create a symlink called “gmic_rollei_retro_80s.cimgz” in your Temp directory that G’MIC will be able to read and use!

With apologies to Allie Brosh

So now we know that symlinks will work, but we don’t want to do this manually for each file.

Turns out it’s one, simple command (assuming you are in your Temp directory):

for %f in (..\gmic-film-presets\*.cimgz) do (mklink %~nf.cimgz %f)

Yep, that’s about it. If you have to reboot your machine, or your Temp directory gets cleaned out for any reason, just re-issue that command. You’ll have access to all of the presets immediately (and off-line).

If you download any new .cimgz preset files that you didn’t already have, just move them into the “gimp-film-presets” directory, and re-run the command.

I haven’t tried this yet on my OSX box to check, but the same principle should work no problem with symlinks. (ln -s …). Can someone with a linux box test this and let us know if it works the same?

Well, the problem with having David Tschumperlé as a contact is that as soon as I write about something in G’MIC, he either implements it, or fixes it!

So, a little less than two hours after posting, David has already modified G’MIC so that the emulation preset files are no longer stored in a tmp/ directory, but rather in the users filesystem. So they won’t disappear after a reboot. So this whole post is now moot…

Thank you David!