Gradient Map

Moderator: Kathy_9

Post Reply
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Gradient Map

Post by LeviFiction »

Script Name: Gradient Map
Download Link: https://drive.google.com/open?id=0B8FlF ... lZBYTlrZ0E
Compatability: 8 - X9 (tested in 8, 9, XI, X7, x8, X9)
Requirements: Place in Scripts-Trusted Folder
Description:
This script attempts to emulate the Gradient Map feature found in Photoshop.

To use it, just select a gradient in the materials palette, and run this script. PSP will attempt to map that gradient's values to the image's luminosity values. To invert the colors just select "Invert" on the color picker.
If you already use Gary Barton's(PixelNook) GradientMap script my script produces about the same result. It's just a little faster due to the method I use to get the gradient colors.

Video -

HISTORY:
v 0.2 - Update - Now performs the gradientmap on a separate image and copies it to a new layer in your current image with the name of the gradient you chose
v 0.1 - Initial release
Last edited by LeviFiction on Thu Jan 11, 2024 1:26 am, edited 4 times in total.
https://levifiction.wordpress.com/
Kathy_9
Site Admin
Posts: 2896
Joined: Tue Nov 30, 2010 12:44 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
processor: 8th Generation Intel Core i7 8700 3 20 GHz
ram: 16GB
Video Card: NVIDIA GeForce RTX 2060 [6 GB GDDR6 dedicated]
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2TB
Monitor/Display Make & Model: HP EliteDisplay E243m 23.8-inch
Corel programs: PSPX2 ~2023; Painter 2018~23
Location: USA
Contact:

Re: Gradient Map

Post by Kathy_9 »

Very cool - thanks.

One small issue. I had multiple layers open and when I ran the script it flattened them all and I'm not knowledgeable enough to change that.
PSPX9 | PSP2020 | PSP2021| PSP2022 | PSP2023 & PhotoMirage installed; PSPX | PSPX2 thru PSP2019 owned but not installed
http://www.flickr.com/photos/37153430@N03/
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Gradient Map

Post by LeviFiction »

Really? You should be able to just hit Undo to go back. If you can't then there is a bug in the Undo system.

I've never had it flatten the image, but yes this doesn't support layers because of the method of mapping the gradient. In order to quickly map the colors the script converts your image to greyscale, this turns your image into a paletted image. We can then simply replace each of the paletted colors with a color from the gradient using the Edit Palette command. Once it's done it restores the bit-depth of the image to normal.

With the way scripts work there is no other way to do this in scripts as quickly as this method does. The KPT plugin Gradient Lab also offers a similar option, it's fast and works on layers.
https://levifiction.wordpress.com/
Kathy_9
Site Admin
Posts: 2896
Joined: Tue Nov 30, 2010 12:44 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
processor: 8th Generation Intel Core i7 8700 3 20 GHz
ram: 16GB
Video Card: NVIDIA GeForce RTX 2060 [6 GB GDDR6 dedicated]
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2TB
Monitor/Display Make & Model: HP EliteDisplay E243m 23.8-inch
Corel programs: PSPX2 ~2023; Painter 2018~23
Location: USA
Contact:

Re: Gradient Map

Post by Kathy_9 »

I wasn't too clear. Yes, undo works. When I said I wasn't knowledgeable to change that I meant change the script to not flatten, but it sounds like that's not an option. It's still a cool script.
PSPX9 | PSP2020 | PSP2021| PSP2022 | PSP2023 & PhotoMirage installed; PSPX | PSPX2 thru PSP2019 owned but not installed
http://www.flickr.com/photos/37153430@N03/
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Gradient Map

Post by LeviFiction »

Okay 5 years (almost 6) later I've updated the script to support layers now. What it does is it first duplicates the image and performs the flatten and gradient map functions there. It then copies the result as a new layer into your original image. And it names the layer after the selected gradient file. If the gradient isn't based on a file (like if you created it using the Gradient Fill tool) it'll just say "Gradient Map".

It won't respect transparency. That will come with version 3 as I need to think through the best process for that. So if you perform it on a single layer that has transparency the background will usually turn completely white which will then be replaced with the "white" tone identified by the gradient.
https://levifiction.wordpress.com/
Kathy_9
Site Admin
Posts: 2896
Joined: Tue Nov 30, 2010 12:44 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
processor: 8th Generation Intel Core i7 8700 3 20 GHz
ram: 16GB
Video Card: NVIDIA GeForce RTX 2060 [6 GB GDDR6 dedicated]
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2TB
Monitor/Display Make & Model: HP EliteDisplay E243m 23.8-inch
Corel programs: PSPX2 ~2023; Painter 2018~23
Location: USA
Contact:

Re: Gradient Map

Post by Kathy_9 »

Works well - thanks.
PSPX9 | PSP2020 | PSP2021| PSP2022 | PSP2023 & PhotoMirage installed; PSPX | PSPX2 thru PSP2019 owned but not installed
http://www.flickr.com/photos/37153430@N03/
Post Reply