Other

Gradient Map/Reverse Gradient Map Script

Gradient Map/Reverse Gradient Map Script

Postby fencepost » Sat Mar 20, 2010 2:54 am

A couple of weeks ago I wrote a script (Gradient Map All Layers) that would gradient map all the layers in an image (initially created to work on animations). A neat feature of the script is that it allows the gradient map to reverse the gradient when it's applied (the gradient map option in GIMP doesn't normally allow for a reversed gradient). David Wood asked me if I could create/modify a script that would do this on a single layer. After showing him my Gradient Map All Layers script, he liked what it did and requested modifications so that it would work on a single layer as well. Below is the result of his request. The script can work on all layers or just a single layer. You pick the gradient, choose if it's to be reversed, and whether it works on all/one layer(s).

Copy and paste the code below into a text file. Save it with an ".scm" extension in your GIMP scripts folder (ie.. C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts). Refresh your scripts (Filters > Script-Fu > Refresh Scripts) and you can find it under Colors > Map > Ultimate Gradient Map...

Or you can download the script already saved as a scm.

ultimate gradient map.zip


Enjoy!

Art

Code: Select all
; GIMP - The GNU Image Manipulation Program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;
;
;
; Script can be found under Colors > Map > Ultimate Gradient Map...


; Define the Function

(define (fp-script-fu-gradient-map-all
   img     
            drawable
            actLayer
            gradient
            gradInvert
            foreground
            background
            )


(gimp-context-push)
(gimp-image-undo-group-start img)

(gimp-context-set-foreground foreground)
(gimp-context-set-background background)
(gimp-context-set-gradient gradient)

(if (= actLayer FALSE)

   (begin
     
      (if (= gradInvert TRUE)
         (map (lambda (x) (gimp-invert x)) (vector->list (cadr (gimp-image-get-layers img))))
      )
      (map (lambda (x) (plug-in-gradmap RUN-NONINTERACTIVE img x)) (vector->list (cadr

(gimp-image-get-layers img))))
   )

   (begin

      (if (= gradInvert TRUE)
      (gimp-invert drawable)
      )
      (plug-in-gradmap RUN-NONINTERACTIVE img drawable)
   )
)


(gimp-image-undo-group-end img)

(gimp-context-pop)

(gimp-displays-flush)


)

(script-fu-register "fp-script-fu-gradient-map-all"
  "<Image>/Colors/Map/Ultimate Gradient Map..."
  "Recolor all the layers or the active layer using the chosen gradient or a reversed version."
  "Art Wade"
  "Art Wade"
  "February 16, 2010"
  "RGB* GRAY*"
  SF-IMAGE          "Image" 0
  SF-DRAWABLE       "Drawable" 0
  SF-TOGGLE       "Work on Active Layer Only?" FALSE
  SF-GRADIENT   "Gradient" "Incandescent"
  SF-TOGGLE       "Invert Gradient?" FALSE
  SF-COLOR      "Foreground Color (Only used if one of the gradient choices uses FG-BG method)" '(0 0

0)
  SF-COLOR      "Background Color (Only used if one of the gradient choices uses FG-BG method)"

'(255 255 255)

)
Members don't see the above ad. Register now - it's free!
I'd rate you as an upper-middle-lower-mod with pro-novice-inter tendencies.....and a twist of lime! Of course, my rating scale is completely objectively subjective, but ALWAYS consistently inconsistent.
fencepost
Jr. Member
 
Posts: 58
Joined: Fri Jan 15, 2010 1:37 pm
Location: Florida

Re: Gradient Map/Reverse Gradient Map Script

Postby David Wood » Sat Mar 20, 2010 11:58 am

Shweet! I love it and I've only used it about 10 times. ;D I'm going to use it in a tutorial too.
Image
User avatar
David Wood
Administrator
 
Posts: 5442
Joined: Wed Jul 22, 2009 2:28 am
Location: Western New York

Re: Gradient Map/Reverse Gradient Map Script

Postby virtualTune » Sat Mar 20, 2010 3:06 pm

couldd someone post what it looks like cuz if i see the word "gradient map" i have a freak out and run away! :(
virtualTune
Retired Staff
 
Posts: 4421
Joined: Tue Sep 01, 2009 11:50 pm
Location: Neverland

Re: Gradient Map/Reverse Gradient Map Script

Postby Maffe811 » Sat Mar 20, 2010 3:27 pm

david, make the tut an show Vt and I
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
Image
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6804
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Gradient Map/Reverse Gradient Map Script

Postby Cyrilshark » Sat Mar 20, 2010 11:26 pm

http://www.photoshopforce.com/tutorials ... /index.php

Seriously you guys, stop begging David to make a tutorial or to do this and that for you, and just find out how to do it yourself... :P
"Do not abandon yourselves to despair. We are the Easter people and hallelujah is our song."
User avatar
Cyrilshark
Administrator
 
Posts: 2130
Joined: Wed Oct 08, 2008 2:33 pm
Location: Good ol' US of A :)

Re: Gradient Map/Reverse Gradient Map Script

Postby Cyrilshark » Sat Mar 20, 2010 11:27 pm

And yes I know it's for photoshop. GM in GIMP is in Colors>Map>Gradient Map
"Do not abandon yourselves to despair. We are the Easter people and hallelujah is our song."
User avatar
Cyrilshark
Administrator
 
Posts: 2130
Joined: Wed Oct 08, 2008 2:33 pm
Location: Good ol' US of A :)

Re: Gradient Map/Reverse Gradient Map Script

Postby Maffe811 » Sun Mar 21, 2010 1:13 am

but we like buggin david :)
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
Image
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6804
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Gradient Map/Reverse Gradient Map Script

Postby David Wood » Sun Mar 21, 2010 1:15 am

He does at that. :P
Image
User avatar
David Wood
Administrator
 
Posts: 5442
Joined: Wed Jul 22, 2009 2:28 am
Location: Western New York

Re: Gradient Map/Reverse Gradient Map Script

Postby Maffe811 » Sun Mar 21, 2010 1:28 am

weres the tut??? :P
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
Image
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6804
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Gradient Map/Reverse Gradient Map Script

Postby David Wood » Sun Mar 21, 2010 1:31 am

see? 8) I have minions
Image
User avatar
David Wood
Administrator
 
Posts: 5442
Joined: Wed Jul 22, 2009 2:28 am
Location: Western New York

Re: Gradient Map/Reverse Gradient Map Script

Postby Maffe811 » Sun Mar 21, 2010 1:42 am

all hail the master of tuts, the king of gimp, the best of the best (when it comes to gimp):
DAAAAAaaaaviiii.... what? wrong name? gimme the note! oh.... okay...
here we go...
GIIIIIMMP KNOOOOWW HOOOOWW!!!!!

(sarcasm)
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
Image
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6804
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Gradient Map/Reverse Gradient Map Script

Postby David Wood » Sun Mar 21, 2010 1:44 am

>:D You will pay for that worthless peasant! :P I just have to come up with a good use of gradient maps and I'll record it. :)
Image
User avatar
David Wood
Administrator
 
Posts: 5442
Joined: Wed Jul 22, 2009 2:28 am
Location: Western New York

Re: Gradient Map/Reverse Gradient Map Script

Postby Maffe811 » Sun Mar 21, 2010 3:34 am

maybe.... ehh.... il leave you thinkin!
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
Image
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6804
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Gradient Map/Reverse Gradient Map Script

Postby virtualTune » Sun Mar 21, 2010 8:18 pm

:!: @Cyril, don't you think he can tell us himself>? btw. in case you haven't noticed, this forum was made to answer questions, even to members that are active! this is not just for CnC and Showoff!!!!
virtualTune
Retired Staff
 
Posts: 4421
Joined: Tue Sep 01, 2009 11:50 pm
Location: Neverland

Re: Gradient Map/Reverse Gradient Map Script

Postby fencepost » Mon Mar 22, 2010 12:48 am

Here's a couple of GIMP tutorials to get you started. They may be a bit dated, but it will help you see how others have used the technique. Most importantly, here's the GIMP manual explanation: http://docs.gimp.org/2.6/en/plug-in-gradmap.html

Tutorials: http://www.gimptalk.com/forum/viewtopic ... 14&t=38359
http://www.gimptalk.com/forum/viewtopic ... 14&t=35761
http://www.gimptalk.com/forum/viewtopic ... 14&t=32296
http://www.gimptalk.com/tutorial/fight- ... 514-1.html
I'd rate you as an upper-middle-lower-mod with pro-novice-inter tendencies.....and a twist of lime! Of course, my rating scale is completely objectively subjective, but ALWAYS consistently inconsistent.
fencepost
Jr. Member
 
Posts: 58
Joined: Fri Jan 15, 2010 1:37 pm
Location: Florida

Next

Return to Other

Who is online

Users browsing this forum: No registered users and 1 guest