Posts: 2
Threads: 1
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
My version: GIMP 2.10.18
Hello, I am asking if anyone has a plugin or script that can do the following: taking a palette (.gpl) and converting it to an image, with one pixel of each color that the palette has.
For example, let's take the input as the Cool Colors palette included with GIMP
The end result after inputting the Cool Colors.gpl in the plugin/script would be this (very tiny 8x1 image):
I do not care if it writes the new image to the canvas, or outputs it as a file. I also do not care whether the colors are in order vertically or horizontally, and the "Number of Columns" in the .gpl can be discarded as well.
The reason I need it is because I posterized a RGB 16-million color space image to levels of 32 red, 64 green, and 4 blue (based on the amount of receptors in the human eye for each color) in Paint.NET. And now I would like to have only the unique colors from it in an image, so I can further reduce that image's amount of colors using GIMP or GrafX2 to make a limited color palette for things like pixel art/game art. For example, I already did this with the Natural Colour System's 1952-color palette. (and if you ask how I got all those colors into an image, it was using the eyedropper on 1952 color swatches!!! But my new .gpl has 8192 colors, over 4 times as much. That's the reason I'm asking for an automation)
https://lospec.com/palette-list/natural-...-system-16
Here is the .gpl file of my new 8192-color palette if anyone wants to use it as a lab rat if they thankfully write the plugin/script
https://cdn.discordapp.com/attachments/4...2-64-4.gpl
Posts: 117
Threads: 23
Joined: May 2017
Reputation:
7
Operating system(s):
- Windows (Vista and later)
Gimp version: 2.10
This plugin ofn-colormap-to-layer should do the trick.
- Downloaded from https://sourceforge.net/projects/gimp-to...s/scripts/
- The zip includes short documentation on usage
Posts: 7,134
Threads: 155
Joined: Oct 2016
Reputation:
1,005
Operating system(s):
Gimp version: 2.10
Unfortunately Ofnuts plugin is for indexed colour maps - 256 colours max ?
I get an error from your monster palette ref. https://cdn.discordapp.com/attachments/4...2-64-4.gpl Can't try it out.
Nothing straightforward that I can find. There might be a dedicated Gimp plugin around, can't find one.
Easier in linux than Windows. You need Python installed to run this script.
https://gist.github.com/mePy2/bb2f6f63af...d1231555f5
And other scripts / plugins used as well Goes like this
Extract the palette to text using Gimp. https://i.imgur.com/YtkDh6g.jpg
The python script uses the default text file name. Looks like this: https://i.imgur.com/6MJ5UfR.jpg
That produces a 1 pix x number of colours png file
Put in some spaced guides ( I use a script for this)
Split into layers using the guides (I use a plugin for this)
Resize the canvas size to suit
Space the layers out using the align tool.
Posts: 2
Threads: 1
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
(12-11-2020, 12:17 PM)rich2005 Wrote: Unfortunately Ofnuts plugin is for indexed colour maps - 256 colours max ?
I get an error from your monster palette ref. https://cdn.discordapp.com/attachments/4...2-64-4.gpl Can't try it out.
Nothing straightforward that I can find. There might be a dedicated Gimp plugin around, can't find one.
Easier in linux than Windows. You need Python installed to run this script.
https://gist.github.com/mePy2/bb2f6f63af...d1231555f5
And other scripts / plugins used as well Goes like this
Extract the palette to text using Gimp. https://i.imgur.com/YtkDh6g.jpg
The python script uses the default text file name. Looks like this: https://i.imgur.com/6MJ5UfR.jpg
That produces a 1 pix x number of colours png file
Put in some spaced guides ( I use a script for this)
Split into layers using the guides (I use a plugin for this)
Resize the canvas size to suit
Space the layers out using the align tool.
Does this mean to put the .py file and palette.txt in the same folder? Also, I assume from the GitHub account's name that this script is meant to be used for Python 2?
Posts: 7,134
Threads: 155
Joined: Oct 2016
Reputation:
1,005
Operating system(s):
Gimp version: 2.10
Quote: Does this mean to put the .py file and palette.txt in the same folder? Also, I assume from the GitHub account's name that this script is meant to be used for Python 2?
I assumed python 2.7 Everything in one folder, that is the easiest way, saves some long paths.
A bit of spare time yesterday, so a try out in a Win10 (VM) to check that it works there. For anyone interested.
First installed python from https://www.python.org/ftp/python/2.7.8/....amd64.msi (all users, default location C:\Python27 )
Next PIL from https://pypi.python.org/packages/2.7/P/P...-py2.7.exe
Get a palette.txt file from Gimp
script palette_generator.py and palette.txt in the python folder
Run from there to generate palette.png screenshot: https://i.imgur.com/Kmec5yu.jpg
Posts: 16
Threads: 4
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
(12-12-2020, 09:04 AM)rich2005 Wrote: Quote: Does this mean to put the .py file and palette.txt in the same folder? Also, I assume from the GitHub account's name that this script is meant to be used for Python 2?
I assumed python 2.7 Everything in one folder, that is the easiest way, saves some long paths.
A bit of spare time yesterday, so a try out in a Win10 (VM) to check that it works there. For anyone interested.
First installed python from https://www.python.org/ftp/python/2.7.8/....amd64.msi (all users, default location C:\Python27 )
Next PIL from https://pypi.python.org/packages/2.7/P/P...-py2.7.exe
Get a palette.txt file from Gimp
script palette_generator.py and palette.txt in the python folder
Run from there to generate palette.png screenshot: https://i.imgur.com/Kmec5yu.jpg
How i can add colormap in batch to multiple image/layers ?
i've tried BIMP but doesn't support Colormap plugin.
After Colormap i have simply to output same set of images.
Thank you
Posts: 6,349
Threads: 274
Joined: Oct 2016
Reputation:
565
Operating system(s):
Gimp version: 2.10
(04-09-2021, 09:06 PM)barrubba Wrote: (12-12-2020, 09:04 AM)rich2005 Wrote: Quote: Does this mean to put the .py file and palette.txt in the same folder? Also, I assume from the GitHub account's name that this script is meant to be used for Python 2?
I assumed python 2.7 Everything in one folder, that is the easiest way, saves some long paths.
A bit of spare time yesterday, so a try out in a Win10 (VM) to check that it works there. For anyone interested.
First installed python from https://www.python.org/ftp/python/2.7.8/....amd64.msi (all users, default location C:\Python27 )
Next PIL from https://pypi.python.org/packages/2.7/P/P...-py2.7.exe
Get a palette.txt file from Gimp
script palette_generator.py and palette.txt in the python folder
Run from there to generate palette.png screenshot: https://i.imgur.com/Kmec5yu.jpg
How i can add colormap in batch to multiple image/layers ?
i've tried BIMP but doesn't support Colormap plugin.
After Colormap i have simply to output same set of images.
Thank you
Possibly (untested)
- Open one layer on convert to indexed to generate the colormap (or force the color map with a palette)
- File ➤ Open as layers the other layers (the dialog lets you select multiple files at once), they will be automatically converted to use the colormap of the image
- Use a script such as my own ofn-export-layers to export the layers to individual files.
Posts: 16
Threads: 4
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
(04-09-2021, 10:44 PM)Ofnuts Wrote: (04-09-2021, 09:06 PM)barrubba Wrote: (12-12-2020, 09:04 AM)rich2005 Wrote: I assumed python 2.7 Everything in one folder, that is the easiest way, saves some long paths.
A bit of spare time yesterday, so a try out in a Win10 (VM) to check that it works there. For anyone interested.
First installed python from https://www.python.org/ftp/python/2.7.8/....amd64.msi (all users, default location C:\Python27 )
Next PIL from https://pypi.python.org/packages/2.7/P/P...-py2.7.exe
Get a palette.txt file from Gimp
script palette_generator.py and palette.txt in the python folder
Run from there to generate palette.png screenshot: https://i.imgur.com/Kmec5yu.jpg
How i can add colormap in batch to multiple image/layers ?
i've tried BIMP but doesn't support Colormap plugin.
After Colormap i have simply to output same set of images.
Thank you
Possibly (untested)
- Open one layer on convert to indexed to generate the colormap (or force the color map with a palette)
- File ➤ Open as layers the other layers (the dialog lets you select multiple files at once), they will be automatically converted to use the colormap of the image
- Use a script such as my own ofn-export-layers to export the layers to individual files.
Ofnut Reply! Great!
There is a way to mantain filename when importing as layer? so i can export filename as well with your Export-layers
thank you
Posts: 6,349
Threads: 274
Joined: Oct 2016
Reputation:
565
Operating system(s):
Gimp version: 2.10
(04-10-2021, 12:49 AM)barrubba Wrote: (04-09-2021, 10:44 PM)Ofnuts Wrote: (04-09-2021, 09:06 PM)barrubba Wrote: How i can add colormap in batch to multiple image/layers ?
i've tried BIMP but doesn't support Colormap plugin.
After Colormap i have simply to output same set of images.
Thank you
Possibly (untested)
- Open one layer on convert to indexed to generate the colormap (or force the color map with a palette)
- File ➤ Open as layers the other layers (the dialog lets you select multiple files at once), they will be automatically converted to use the colormap of the image
- Use a script such as my own ofn-export-layers to export the layers to individual files.
Ofnut Reply! Great!
There is a way to mantain filename when importing as layer? so i can export filename as well with your Export-layers
thank you
AFAIK the layer takes the name of the file it comes from. OEL has two possible values in the pattern ( {name} and {rawName}) for this reason: the layer name may contain an extension ( .jpg, .png) that you can to remove and replace by your own ( .gif) so you likely want a name pattern like {name}.gif.
Posts: 16
Threads: 4
Joined: Dec 2020
Reputation:
0
Operating system(s):
- Windows Vista or 7, 8, 10 (64-bit)
Gimp version: 2.10
I'm trying to use your REPLACE-COLORMAP plugin but sure i'm missing some step.
I index an image with a custom palette, then i select in right panel a new palette (that i want to reapply to the image) with same color numbers.
I get this error:
GIMP Errore
Plug-in "ofn-replace-colormap.py"
(C:\Users\rnode1\AppData\Roaming\GIMP\2.10\plug-ins\ofn-replace-colormap.py)
attempted to install procedure "temp-procedure-number-8" with invalid parameter name "num colors".
GIMP Errore
Errore di chiamata per la procedura "gimp-palette-get-colors":
La procedura "gimp-palette-get-colors" è stata chiamata con il valore "(null)" l'argomento "name" (#1, tipo gchararray). Questo valore è fuori limite.
What i'm wrong?
|