A GIMP Script for the "Retro" Look

Sometimes, we tend to apply the same effect to a number of our photographs. In this case, we would like to simply have a one-click solution, instead of manually going through the same 20 step process. This is where scripting comes into the picture (pun intended).

The "Retro" look is rather popular with most people who call themselves "digital photographers", which I think is strange. You have the best digital camera, which can reproduce such perfect colours, and you still want that 70s film effect?

But it is not my place to pass moral judgement. My job is to just hand over a script that will allow you to make images look like this

using a one click filter. from an image like this

The methods I use to achieve a retro effect are similar to the methods I outlined in the tutorial on achieving a film-effect using the GIMP. However, since then, I've taken some time to refine that effect, and I present this improved version.

One point that you must remember when you script in the GIMP is that the script is essentially a programme in Scheme, a dialect of the Lisp language (no, please don't start lisping now). Essentially, you are programming in Scheme, using a GIMP API; at least, that's how I like to view it. (Remember, real FOSS users prefer to use the console for everything. So, if you are using the GIMP, I would recommend that you stop using the GUI immediately, and instead, use the script-fu console for each task. (Just Kidding. Don't worry, you can use the GUI. (If you are not yet used to the nested parenthesis, get used to them, you'll encounter lots of them while programming. (Serious!))))

My difficulty primarily is that I cannot run a tutorial on programming in Scheme, which is what you'll need if you were to write your own script. Instead, I'll invite you to find tutorials on the internet, and also direct you to the GIMP tutorials on scripting. I'll simply present the script I created and used to achieve the "Retro Effect" in the sample image.

The code is listed here:
UPDATE: The code is now available on my GitHub repository.


; Apply a retro effect to an image
; This is an example script only. Values must be changed to suit your tastes

(define (script-fu-retro-effect img 
    drawable )
 ;Create a new layer from the visible image
 (define curves-layer (car (gimp-layer-new-from-visible img img "Curves")))

 ;Insert it in the image
 (gimp-image-insert-layer img curves-layer 0 0)

 ;Modify the curves
 (gimp-curves-spline curves-layer HISTOGRAM-RED 8 #(0 0 61 41 187 207 255 255))
 (gimp-curves-spline curves-layer HISTOGRAM-GREEN 8 #(0 0 50 57 195 217 255 255))
 (gimp-curves-spline curves-layer HISTOGRAM-BLUE 4 #(0 40 255 215))

 ;Soft light layer for added contrast
 (define soft-light-layer (car (gimp-layer-new-from-drawable curves-layer img)))
 (gimp-item-set-name soft-light-layer "Soft Light")
 (gimp-layer-set-mode soft-light-layer SOFTLIGHT-MODE)
 (gimp-layer-set-opacity soft-light-layer 40)
 (gimp-image-insert-layer img soft-light-layer 0 0)
 (gimp-desaturate-full soft-light-layer DESATURATE-LUMINOSITY)

 ;Now, add vignette layer group
 (define vignette-group (car (gimp-layer-group-new img)))
 (gimp-item-set-name vignette-group "Vignette")
 (gimp-layer-set-mode vignette-group OVERLAY-MODE)
 (gimp-layer-set-opacity vignette-group 40)
 (gimp-image-insert-layer img vignette-group 0 0)

 (define img-height (car (gimp-image-height img)))
 (define img-width (car (gimp-image-width img)))
 
 ;Now, for the vignette layers
 (define vignette-white (car (gimp-layer-new img img-width img-height RGBA-IMAGE "White" 100 NORMAL-MODE)))
 (gimp-image-insert-layer img vignette-white vignette-group 0)
 (gimp-context-set-foreground '(255 255 255))
 (gimp-edit-blend vignette-white FG-TRANSPARENT-MODE NORMAL-MODE GRADIENT-RADIAL 100 0 REPEAT-NONE FALSE FALSE 1 0 TRUE (/ img-width 2) (/ img-height 2) (* img-width 1.5) (* img-height 1.5))
 (define vignette-black (car (gimp-layer-new img img-width img-height RGBA-IMAGE "Black" 100 NORMAL-MODE)))
 (gimp-image-insert-layer img vignette-black vignette-group 0)
 (gimp-context-set-foreground '(0 0 0))
 (gimp-edit-blend vignette-black FG-TRANSPARENT-MODE NORMAL-MODE GRADIENT-RADIAL 100 0 REPEAT-NONE TRUE FALSE 1 0 TRUE (/ img-width 2) (/ img-height 2) img-width img-height)
 
 ;Finally, set the tint layer
 (define tint-layer (car (gimp-layer-new img img-width img-height RGBA-IMAGE "Tint" 20 DIFFERENCE-MODE)))
 (gimp-image-insert-layer img tint-layer 0 0)
 (gimp-context-set-foreground '(5 10 150))
 (gimp-edit-fill tint-layer FOREGROUND-FILL)

 ;And flush the display so as to reflect the changes
 (gimp-displays-flush)
)

; Register the script so that GIMP may use it.
(script-fu-register "script-fu-retro-effect"
   "Retro Effect"
   "Apply a retro effect to visible image"
   "Skand Hurkat"
   "Skand Hurkat"
   "2012"
   "RGB*"
   SF-IMAGE "Image" 0
   SF-DRAWABLE "Image to apply retro effect" 0)

; This script will appear as a filter named "Retro Effect" in the Filters > Artistic block
(script-fu-menu-register "script-fu-retro-effect"
   "<Image>/Filters/Artistic")

Simply copy the script in a file named retro-effect.scm in the GIMP scripts directory. You'll find the script in Filters->Artistic when you restart the GIMP. Alternately, you can just refresh the Script-Fu scripts.

Keeping in sync with the "non-destructive editing" philosophy that I follow, this script copies the visible image onto a new layer, modifies curves, adds a soft light overlay, adds a vignette, and finally corrects colours further with a tint. Each of these layers is preserved, so if you want to change any of the layer parameters like opacity, blending mode, etc.; you can easily do so.

That's it, that's your first GIMP script. Do leave a comment if you like it, leave a comment if you modify the script when you use it, so that others can benefit from the modification. If you like this post, hit the "+1" button and make this page easier for you friends to find.

BTW, the roadside restaurants at the Old Port, Montreal offer awesome food and a great view of the streets. If only they catered more to vegetarians...

Comments

  1. Awesome post. Would love for you to join us on http://www.facebook.com/groups/326042310770868/

    ReplyDelete
    Replies
    1. Thanks for your appreciation. Will join the group.

      Delete
  2. Great script! "Gotta" love the effect it produces :D And thanks for explaining it to me! :)

    ReplyDelete
    Replies
    1. Thanks for the appreciation Manasa. Yes, I have psychic abilities!

      Delete
  3. Hello,
    i just tried your script on some random image and got this error (GIMP message)

    Error: eval: unbound variable: gimp-image-insert-layer

    Anyone else had this ?

    ReplyDelete
    Replies
    1. Hi,

      What version of GIMP are you using? I tested it on GIMP 2.7.5.

      The error may be because you are on an older version of GIMP. Older versions used "gimp-image-add-layer", which is now deprecated. It is advised that new scripts use "gimp-image-insert-layer".

      Delete
  4. Thx for answer.
    I'm using gimp version 2.6.11. I tested 2.7 but had troubles with it so I'll try changing gimp-image-insert-layer to gimp-image-add-layer.

    ReplyDelete
    Replies
    1. Well, i just did, and got some now error
      "Invalid number of arguments for gimp-image-add-layer (expected 3 but received 4)
      so i bet i'll install 2.7 back, or wait 2.8 is out !

      Thx for support anyway !

      Delete
    2. Okay, I'm sorry... In my haste to make my script compatible with the later releases of GIMP, I used some features found only in GIMP 2.7 or higher, like layer groups. I'll rewrite the script to be compatible with GIMP 2.6; again, I might not, considering that GIMP 2.8 is just round the coner...

      In the meantime, I suggest that you download the development release of GIMP 2.7. Get it here for Windows.

      Delete

Post a Comment

Popular Posts