Import GIMP Gradient

I’m fairly certain you saw this coming considering the scripting spree I’ve been on lately. xD

GIMP gradients work differently than PSP gradients. Specifically in how the gradients themselves are calculated. They have several different algorithms for intepolating between colors, while PSP only uses one. So not al gradients imported into PSP will look like a 1 to 1 match with GIMP Gradients.

It is possible that one day I may find a way to convert these other models to PSP’s linear model but for now I just force all gradients to be linear.

Version History:
V1.0 – Initial Script released, imports gradients one at a time
V1.1 – Secondary release – can now import several gradients at once

Script Name: ImportGGR
Download Link: … sp=sharing
Compatibility: X4 – X9 (tested in X7, x8, X9, 2018)
Requirements: Place in Scripts-Trusted Folder


Import GIMP Patterns

The last of the GIMP file format importers. This one takes GIMP Pattern file (.pat) and converts them into PNG files and places them into your patterns folder. You can select multiple patterns at once to import if you wish.

Version History:
V1.0 – Initial Script released, imports patterns.

Script Name: ImportGIMPPat
Download Link: … sp=sharing
Compatibility: X4 – X9 (tested in X7, X8, X9, 2018)
Requirements: Place in Scripts-Trusted Folder

Import Gimp Image Pipe

In GIMP an Image Pipe or Animated Brush is the equivalent of PSP’s Picture Tubes. In fact, GIMP has the ability to import PSP Picture Tubes and save them as Image PIpes. So I figured we should be able to do the same.

The script works like this. Gimp Animated Brushes or Image Pipes are just a collection of regular GIMP brushes. So, what I do is I calculate the final size of the image, then save out each brush head as a PNG file, importing them back in and copying them into the final image. This is very slow when dealing with large brushes.

I am working on a way to make this faster by pre-making the final image instead of slowly loading images in. But for now, this should, hopefully, suffice.

Script Name: Import Image Pipe
Download Link:
Compatability: X4 – 2018 (tested in X7, x8, X9, 2018)
Requirements: Place in Scripts-Trusted Folder

Gimp Color Palette Converter

GPL Files are how GIMP stores some of its color palettes. It’s a very simple list of RGB values with a name.

This script will import the colors as swatches into the currently selected gradient.

GIMP allows swatches in the same palette to have the same name, PSP does not. So when importing swatches with the same name will be auto-incremented.

Download Link: … X3w9Is5Z0m
Compatability: X4 – 2018 (tested in X7, X8, X9, 2018)
Requirements: Place in Scripts-Trusted Folder

Adobe Color Palette Converter

ACO files are Adobe’s Color Swatch/Palette files. They can contain any number of color swatches in multiple color formats: RGB, HSB, CMYK, LAB, Greyscale.

This script allows you to select any ACO file from your hard drive and import them as swatches into the currently selected swatch palette. If they have a name inside the ACO file that name is how the swatch will be named.

Currently, LAB colors are not supported and CMYK has not been tested. So I can only guarantee the RGB, HSB, and Greyscale colors will be converted properly with this script.

Download Link: … sp=sharing
Compatability: x4 – 2018 (tested in X7, X8, X9, 2018)
Requirements: Place in Scripts-Trusted Folder

GIMP Brush Converter

GBR files are one of several Brush formats that the GIMP uses. At the moment this script only properly supports greyscale brushes. Plans to add 32-bit support are in the work.

Because of how scripting works in PSP I have to jump through a few hoops to get this to work but it’s pretty fast with very little needed from you.

The script opens a brush file, converts it to a bmp file and saves that file to your hard drive in the same location as the GBR file.   The script then opens that file in PSP and exports it as a brush. followed by closing the file and then deleting it.

Just make sure that your brushes are in a folder that can be written to without administrative privileges.

Download Link … sp=sharing
Compatability: X6 – 2018 (, 2018)
Requirements: Place in Scripts-Trusted Folder

Version History:

v1.0 – Initial brush script – only supports greyscale brushes

v1.1 – added support for 32-bit true color + alpha brushes.

PSP Scripting 201: Basic Python: Functions and Libraries

I’ve shown you next to no functions available to you in Python.  We’ve covered print, round(), list(), dict(), tuple(), and I’ve shown input().  There are more commands/functions available for you to use.  Python not only has a large number of default commands, but it also comes with a series of standard libraries that include even more functions available for you to use.

I won’t be getting into them, but it’s important to know how libraries are imported into your script.  This is because the first line of any PSP script imports a library known as PSPApp.  In PSP8 and 9 it’s JascApp.  PSP is backward compatible with older versions of PSP so a script that imports JascApp will also run in newer versions of PSP.

Let’s look at the two main ways you can use to import a library.  We’ll use the math library to keep things simple.

The most common and preferred way to import most libraries is done with a very simple

import LibraryName

That’s it.  I now have access to all of the commands stored in the math library.  Commands such as sin(), cos(), radians(), etc.  If you import libraries this way then you end up calling a command you must prefix the command with the name of the library followed by a period and then the command.

import math
radians_of_180Degrees = math.radians(180)

The less preferred method for importing is to import every function, class, and variable.  This is less preferred because it has the potential to cause naming conflicts if you bring in too many libraries and it uses up a lot more memory.  This method removes the need to prefix the command name with the library name.  The syntax is equally simple.

from LibraryName import *

The asterisk at the end is a wildcard that means “everything”.  You can also limit your import to only a single set of functions by replacing the asterisk with the name of the function you wish to import.

This is the method that we use to import JascApp and PSPApp.

from JascApp import *

This must always be the first line of any script.  If we want to import other libraries after it that’s perfectly fine.  But this should always be the first.


Alright, now let’s look at how to create our own functions.  Or, more specifically, how a function definition looks.

Python, like any programming language, would be of very little use if we couldn’t make our own commands that do those special things we want it to do.  Functions can be thought of as miniature programs inside our main program.  This is overtly simplistic but it’ll do.

When you call a function it performs an action, and can even return a result.  Take for example, let’s say we wanted a function that took two lists and returned the difference between them.  Well we could go looking for a library that contained such a function, or we could make it ourselves.

In order to use a function you must first define it.  Defining a function gives it a name, and tells Python what parameters it uses.  Parameters are just variable that will hold data.  These variables only exist inside the function and are only set when the function is called.

Here is how a standard Python function definition looks.

def FunctionName(param1, param2):
    #some code here for the function to perform

As you can see you start creating a function by first using the keyword “def” in all lowercase.  This tells Python we are “defining” a new function.  Then we provide it with a name.  This name must follow the same restrictions as a regular variable name.  Next, inside a pair of parentheses you enter in the names of the parameter variables you’ll be using inside the function.  Name these whatever you want, just be sure they are meaningful to you.  Finally we end with a “:” to begin a new code block.

Let’s look at a simple standard example.   This is not a useful function but it gets the idea across.

def printAdd(num1, num2):
    print num1 + num2


The result of this program should be Python printing out the number 7 to the screen.

I would like to point out that I stopped using an indent when I was done with the function.  This ends the code block and lets me get back to the rest of the program.  I will also not be able to cal num1 or num2 outside of this function as they only exist within that function.  I think I’ll quickly address variable “scope” next tutorial.


So let’s say we wanted to return some information from the function.  We do this using the “return” keyword.  This keyword is very simple, it returns whatever follows the keyword be it a number, string, list, dict, or tuple.  You can return multiple values by separating them with commas.  This will create a tuple.

return can also be used by itself to simply end the execution of the command without returning anything.  An exit early option.  Something you may find yourself doing in your scripts.

Here’s an example of returning a value

def add(num1, num2):
    return num1 + num2

print add(num1,num2)

And here is a common example of quiting a PSP script early if there are no open images.  This will include things you’re not familiar with but I think you can handle it.

def Do(Environment):
    if len(App.Documents) == 0:  #No open documents
    #The rest of the script if documents were open

There is a lot more to Python scripting than this.  We never even got into loops, or splices, adding to lists, removing from lists, bitwise operators, opening files, accessing the internet, etc.  Python is so powerful it’s truly amazing that they thought to use it as the language of PSP scripts.

There is only one more topic I want to cover before we get directly into scripting inside of PSP.  Knowing what few things I’ve covered will help you to recognize what it is you’re seeing when you read a PSP Script.

The last topic we’ll cover is scope.  While not usually seen in most scripts, I think it’s an important topic to cover.

Remember, if you want to learn more about Python programming, or to get more thorough descriptions and maybe a bit more accurate information I o recommend you seek out some official python programming help.

Polarize Effect

This script attempts to create a simulated “polarized” effect.

Photographers sometimes use polarizing filters when taking pictures in order to adjust the intensity of colors and reduce reflections in their photos.  This script attempts to mimic that.  To make colors more intense.  Though this won’t reduce reflections as there is no getting back data that was never there to begin with.

Script Name: Polarize3
Download Link:
Compatibility: XI-2018 (tested in  XI, X2, X8, X9, 2018)
Requirements: Place in Scripts-Restricted Folder

PSP Scripting 201: Basic Python – if this then that

So, to get started today I want to introduce one more data type and one simple command.  But first, comments.


Comments inside of Python are a way to add descriptive text to your script and have it be ignored by the interpreter.  So you don’t have to worry about Python freaking out when you need to explain why or how you did something in your script.

To write a single line comment simply put a “#” in front of it

#this is a comment


The boolean data type has only one of two values.  True or False.  Older versions of Python don’t have True or False as defined keywords but the concept still works.  Each data type has its equivalent version of True or False.

With Numbers 0 is the equivalent of False, and any other value is interpreted as being True.

And, oddly, an empty string is not the equivalent of False.  But if you check for the truthfulness of an empty string it’ll return False.  I’ll show you in an example later.

This will come in handy with conditional statements.  But before we get into If statements we’ll look at our first real command print.


Remember that Python is a case-sensitive language.  So it’s always “print” and never “Print.”

print is a simple command that does one thing, it “prints” whatever text you want to the screen.  Or, in the case of PaintShop Pro, to the Script Output Palette.

print is a bit different from other commands in Python.  Namely that when you usually call a command in Python you need to include all parameters for that command between parentheses.  Take for example round().   round() takes two parameters, one is optional, a Real number and a precision number and returns a float.

round(2.623342362, 2)

And so now I’ve introduced you to round instead of print, let’s get back on track.  As you can see the two parameters 2.623… and 2 are passed to the round command between ().  This is normal.  print doesn’t follow this convention though.  In Python3 they change this but since PSP is still using Python 2.7 our version of print does not use parentheses.

print can take any number of parameters, just make sure to separate each with a comma.  If the parameter is not text print will attempt to convert it to text automatically.  But only if it’s not in the same parameter as some text data.  Let me show you.

#This is an example of printing various data types
print "This is a string"
print 2
print 2.0, True, "String #2"
print int

The output looks something like this.
>>> print “This is a string”
This is a string
>>> print 2
>>> print 2.0
>>> print 2.0, True, “String #2”
2.0 True String #2
>>> print int
<type ‘int’>

Alright, now let’s look at conditions and the “if” statement.


Conditionals are any statement that produces a True or False result.  This is done with the use of comparison operators.  Similar to performing math with a variable or piece of data on one side of the operator, these operators always produce either True or False.

== – Equal to – checks if the two pieces of data are equal to each other.

!= – Not Equal To – checks if two pieces of data are different returns True if they are, False if they are the same

<> – Also Not Equal To – far as I know it’s just another way to write the same thing

> – Greater than – checks to see if the left side is greater than the right, returns True if it is

>= – Greater than or equal to – checks to see if the left side is greater than or equal to the right side

< – Less Than – checks to see if the left side is less than the right

<= – Less Than or equal to – checks to see if the left side is less than or equal to the right

So let’s go over a few quick examples

print 1 == 1 #should print True
print 1 == 2 #should print False
print 2 < 1 #should print False
print "1"  1 #should print True because "1" is not the same as 1
print 0 == False #should return True
print '' == False #should return False

if Statments

if statements are an awesome tool in programming that allows you to perform actions based on conditions.  For example, if you only wanted to perform an action if a person’s age was above a certain level you can use an if statment to check if my_Age > 32.  And if that condition returns true, perform some additional steps.

To understand how if statements work I need to introduce you to indentation and code blocks.

A code block is a small section code that is separated from the rest of your script and only run under specific conditions.  Code blocks are used with custom commands you build yourself, with if statements, loops, classes, etc.  Any time we need a small bit of code to operate semi-independently from the rest of the script we use code blocks.  And code blocks are defined by their indentation.

I’ve mentioned this a few times but Python really really cares about how much indentation you use, and what types.  You can use as much or as little indentation as you want, but you have to be consistent.  A tab may indent you the equivalent of 4 spaces visually, but a tab is not the equivalent of 4 spaces.  So when you create code blocks by using tabs, then every line of that code block must be defined using tabs.  If you try to mix and match tabs and spaces Python will throw a fit wondering where the extra indentation came from.  Why did you change?  Now it doesn’t know what you’re doing and it’s going to error out.

This is why, when setting up Notepad++ and VS Code we made sure to convert tabs into spaces.  It just makes life easier.

The if statement is the most common way you’ll create code blocks in Python.  And it’s the first step to making your scripts “smarter” in PSP.  Here is the format of the if statement.

if >condition<:
    #begin code block

Let's say that you have a program that asks for input, and you want to react to their input.

#ignore this command, for now, it won't work in PSP, it simply gets text from the user.
cmd = input('Do you want to Proceed Y/N')
if cmd == "Y":  #if  :
    print "Great!  Glad to hear it"  #indent is 4 spaces here

elif and else

It’s also possible to respond to multiple possibilities with the same if statement by using elif and else.

else is a catch all for any condition we don’t check.  So if our first condition is false, else will run instead of the if statement. Take our example above, it only responds to an input of “Y”.  But it doesn’t respond to “N” and it definitely doesn’t respond if someone inputs an incorrect value like “2.”  If we were to add an else statement we could catch both of those examples and respond with the same thing.

cmd = input ("Do you want to Proceed Y/N")
if cmd == "Y":
    print "Great! Glad to hear it."
    print "That's fine, ending transmission."  #notice my indent matches

So, now if the user types “Y” and nothing else it’ll print “Great! Glad to hear it.”  But any other value, “N” or “2” or “What the heck is this?” will all respond with “That’s fine, ending transmission.”

Next let’s talk about elif.

elif is short for Else If.  elif lets you check a secondary condition.   What this means is that if the first condition is False you can check another specific condition before defaulting to else.

So let’s pick up our example again.  Let’s say we want three different messages.  if they say yes “Great! Glad to hear it.”  if they say no, “Understood, ending transmission.” And if they say anything else, “I”m sorry, I didn’t catch that.”

cmd = input("Do you wish to Proceed? Y/N")
if cmd == "Y":
    print "Great! Glad to hear it."
elif cmd == "N":
    print "Understood, ending transmission"
    print "I'm sorry, I didn't catch that."

Although this seems rather simplistic here in a PSP script this is very powerful as we can decide how to proceed based on various things.  Such as whether or not there is an open image.

if App.TargetDocument == None: #no image is open for us to use
    return #simply quit the script

Or if we want to know if we need to resize the image or not

if App.TargetDocument.Width < 800: #if image is wider than 800 pixels
    #perform resize command here

I realize App.TargetDocument looks weird compared to everything else we've done so far but I promise I'll get to that soon.

As you can see, this one command offers us the ability to not just look at data, but respond to it.  To make intelligent decisions based on what's going on.

Next tutorial I'm going to introduce you to the basics of custom commands or functions as they're called.  How to make your own and how to import libraries of functions that other people have made to extend the functionality of Python.

Blog at

Up ↑