That’s amazing, thank you. I already spent hours on this, and I could only see spending many hours more. You saved me a ton of time. Maybe I’ll have to learn how to use imagemagick myself.
Fwiw, in the folder containing the “aa” images, the lighter colour has some degree of transparency, meaning they are unsuitable for use on varied backgrounds. The folder containing “noaa” images are all solid colours, and are suitable for purpose.
Both folders lack the green colour set though - could I trouble you to add those, too?
one can edit palettes in gimp afaik. I have done this for icons for work. as you solved it already …
in gimp i seem to remember you need to restrict palette to a number of colors like 4 or 5 which you can then edit.
Yes, I did some more digging and found the colour exchange tool, which combined with posterizing to 2 colours works well, and if I had found that out earlier I probably would have soldiered through it all myself, doing each of the 100+ images individually. The problem for me was/is batch processing.
(Now that I think about it, I could probably paste the 18 images into one sheet, meaning I’d only need to do the colour conversions six times, divide up the sheet with guides, and slice back into 18 images.)
Ah yes that explains the on-going scripting. I didn’t read close enough after the first post (just woke up). Then image-magick is the way to go.
Because I am curious, I prompted chatGPT “hey i have icons with a very small palette like 8 colors. I need these icons in a bunch of different colors. Since this will result in about 90 new files can you suggest a way for me how to proceed with this quickly?”
It answered with Imagemagick and an example shell script Obviously this would need additional prompting.
convert icon.png -fill "#00FF00" -opaque "#FF0000" green_icon.png
and this script
#!/bin/bash
base_icon="icon.png"
colors=("red" "#FF0000" "green" "#00FF00" "blue" "#0000FF" "orange" "#FFA500")
for ((i=0; i<${#colors[@]}; i+=2)); do
name=${colors[i]}
hex=${colors[i+1]}
convert "$base_icon" -fill "$hex" -opaque "#FF0000" "icon_$name.png"
done
This can easily be expanded.
I learned something. So thanks for asking the question in the first place. Imagemagick wouldn’t have been my first idea because I haven’t worked with it much in the past. (once it is mentioned I can see it is the solution for scripting the problem)
I am awful with shell scripts I will always need to search (google/stackoverflow/chatGPT) to find such solutions.
Yes, I also need to get better at asking the right questions. I did try just getting ChatGpt to do it for me, and it described a sensible enough process, but not how to go about it myself, and proceeded to make an absolute hash of it, and thereby exhaust my daily free token allowance.
I kind of supposed that you tried searching and didn’t obtain a result.
Searching with these new tools is far from trivial it seems. Obviously, I already saw your solution and could abstract it into a prompt that delivered the desired result.
I always assume that I need multiple prompts to arrive at a feasible answer. So I try to use the first to get a direction which I can evaluate before continuing down that path. And then I can refine the script.
My next steps here would be:
- tell me exactly which tools I need and what kind of runtime environment
- do a trial run on a single image to verify the central imagemagick command
- specify precise number of colors
- get it to read the palettes from a file
- get it to help generate the palettes (if so needed)
Then keep at it until it works. This does not use a lot of tokens. I had no idea there is a free amount that can be used up. I have been using perplexity.ai a lot more these days.
I think what keeps most people from going down that route is that they cannot set up the tools and that they lack the basic technical knowledge that allows them to abstract problems into their basic technical operations.
I tried to help my friend with a similar problem with image meta-data with photos and detecting duplicates. I used chatGPT to create a python script for her to run. She was unable to use it. Her daughter tried helping her but she was then too afraid to have a go at it.
Yeah, my thinking did not go beyond how to do it using GIMP. So, GIMP plugins, the BIMP tool I found for batch processing, etc.
Would also be trivial using Photoshop, but that’s an expensive solution.
I would have no idea what to do with a Python script, and I still don’t know what to do with the scripts in this thread, but after work I am going to look into Imagemagick.
The answer to many problems is automation.
Automation needs… programming usually.
Setup for that is far from trivial in many cases and acquiring the knowledge for that also isn’t.
I think this level of technical knowledge needs to be taught (more and better) in schools. Attempts are made here but …
For example, I just installed ImageMagick, apparently, but I don’t appear to have any way to run it. It seems I need to use command prompt to do anything with it? But the proposed test prompt doesn’t do anything, so there’s some fundamental basic understanding of command prompt use that I lack. I had to install ImageMagick again to recall where I installed it to, because that’s not normally something I pay any attention to…
Depending on what shell you tried to use it may not have imagemagick on its “path”
Both WSL and Powershell or even windows prompt need to know where imagemagick is located. For Powershell you would need to add it to the windows path variable for example.
(I prefer WSL these days but that’s a whole different can of worms)
PS: my chatgpt prompt “I installed imagemagick on my machine and want to use it via shell. what is the most likely reason it is not working as expected?”
If you installed it in Windows, I think there are some gotchas and required workarounds.
convert
is apparently a windows utility for converting disks from FAT to NTFS.
Here’s an article written by the community for workarounds:
Here’s a workaround provided by the ImageMagick documentation, which would probably be the way I would go for a short engagement with IM
SETLOCAL EnableDelayedExpansion
SET IMCONV="%PROGRAMFILES%\ImageMagick\Convert"
...
%IMCONV% -size 128x128 xc:white test.gif
Regarding the missing green family; that’s a late-night flub on my part. Please re-download the previous link for an all-inclusive list
I was lamenting similarly just a couple of weeks ago. Technology Literacy is a huge problem that doesn’t seem to be being addressed.
This is interesting. I do not see any degree of transparency when pulling these files into Paint.NET
On the base layer, I made a garish green rectangle, and then in a layer above, I pasted in the aa
version of the purple Family_a (transposed downward), and then on a 3rd layer, I pasted in the noaa
version of the purple Family_a (transposed upward), and then merged all the layers.
Curious what tool/software in which you’re seeing the transparency effect
In GIMP, just a cursory examination, but it appears on closer examination to be some weird visual representation of the limited colour palette.