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 rest of my GIMP tutorials can be found here:
Getting Around in GIMP

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.

Get Files

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.

Move Files Around

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.

Symlinks in Windows

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!

Symlink All the Things!



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.

Linux (and possibly OSX) Users

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?

Stop the Presses

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!

7 comments:

  1. On my linux system (I'm using Fedora 19), I found the cimgz files in /tmp . The procedure is slightly different:

    - create the permanant directory in the user's home dir:
    mkdir ~/gmic-film-presets/

    - change to the /tmp dir:
    cd /tmp

    - move the cimgz files to the permanent dir:
    mv *.cimgz ~/gmic-film-presets/

    - create the symlinks. This will have to be done every time you reboot:
    cd /tmp
    (The syntax for the ln command and the for loop is different from windows)
    for f in ~/gmic-film-presets/*.cimgz ; do ln -s $f $(basename $f) ; done

    It works for me. Thanks!

    ReplyDelete
  2. Hi. Thanks to David Tschumperlé for solving this... But what will i complain about from now on?...

    ReplyDelete
  3. hi

    I updated gmic and still have the problem when I'm offline

    ReplyDelete
    Replies
    1. Are you using a relatively recent version of G'MIC? Have you updated your filters to get the new ones? (You'll have to do this for it to work correctly - just hit the refresh button in the G'MIC window to update your filters).

      Also, did you do the [Downoad all presets] option?

      Delete
  4. hi!
    i have linux mint 15 and i update today gmic with some new extras, such as: 'collages' it is really helpful, and thanks for that. i go to download section in gmic, film emulation presets and what i do next is: 'download all presets' about 80mb. after that i have already path in my 'home' dir: /my_name/home/.gmic_film_presets.

    what i want to ask is: is it all presets in that dir? because i dont have .cimgz in temp dir.?

    ReplyDelete
    Replies
    1. That's right, all of the cimgz files will now be in that new directory. Have fun!

      Delete
  5. Thanks, Pat, I'll look into doing that. I tried to do an automatic update from within GIMP and just got an error.

    ReplyDelete