Download[]
https://github.com/PetrifiedLasagna/palette-matcher
One quick reminder, this DOES NOT create QR codes or anything of the like, but it makes the process of graphic conversion easier and more hassle free.
Let's say you wanted to use this image as the background of a title screen.
Step 1. Setup[]
Yes it's amazing I know, but how are you gonna keep this image looking as good as this without spending a few hours making the palette and then importing the image. INTRODUCING........(drum roll)........ Palette-Matcher. A program which can do this in a matter of seconds(depending on image size). Here is what you'll need when working with this program.
- The program(of course). Get the precompiled version from my repo at https://github.com/PetrifiedLasagna/palette-matcher
A lawyer- A basic understanding of windows command prompt
- A program that can open multiple image formats(I use Paint.NET). Do Not use GIMP. it seems to give weird results(most likely because GIMP saves the image with indexed colors)
- A program that can turn images into PTC QR codes
- And...... an image(In TGA format with no compression)
Right click and save the image above if you want to follow along. First get your image and the program in the same directory like so.
There is only one problem... This image is a JPG so we need to open it and save it as a TGA image. Once it opens in Paint.NET you simply click file>Save as and save it as a Targa(TGA) image.
Step 2. Exporting the palette[]
Now onto actually using the program. To do this you will need to open up windows command prompt. If you are using a version of windows after xp (vista and up), you can simply hold shift + right click on any empty location and you will have an option to open command window here. Otherwise you will need to goto START > Run and then type in cmd. You can then use the command CD(current directory) and navigate your way to the location of the program and image. Your screen should look something like the following.
So first off let's export the palette, but remember that Petit Computer has a color limit of 256 and small changes in color are not usually noticable. However I have created this so you can specify a maximum number of colors and the minimum difference for when a color is 'unique'. so let's do that by typing into the windows command prompt
palette-matcher -eLSD-dream.tga -oNew-image.tga -m256 -d50
Here is what each command is specifying
-e: This stands for export and should be the name/path to the source image(in this case LSD-dream.tga)
-o: This stands for output and will be the name of the new file that is created(New-image.tga)
-m: This stands for maximum and is used to specify the maximum amount of unique colors(256)
-d: This stands for difference. A color must be this different or more to be considered unique. Since this image is very colorful we used a higher difference value
When palette-matcher is done it should say "Image saved succsefully"(yeah, i know), and "complete". There should now be a new image in you folder called "New-image.tga". Try opening it to see what it is, it should look like a long strip of different colors. This is the palette of the image(with the commands you specified).
Step 3. Importing the palette[]
Now we can import this new palette to see what the image looks like. Type in the following
palette-matcher -eLSD-dream.tga -iNew-image.tga -oNew-LSD.tga -m256 -d50
The new command, -i stands for import and is used to import the palette. You can also import a modified version of the palette. Let's say you had this image
If you changed the color red in the palette to pink and then imported it, the new image would have red replace with pink. Anyways, here is the finished results of this walkthrough. Of course if you wanted to import this into PTC you would have to resize to fit the resolution of the screen.
As you can see there is very little difference in how the image looks, and now you have a palette and image which can be imported into something like PTCUtils.
Command Line reference[]
R = required
O = optional
Set 1:[]
Find closest match of colors in image to those in a palette image
R -sPath\To\Source.tga
R -pPath\To\Palette.tga
O -oName\Of\NewFile.tga
Set 2:[]
Export palette of image
R -ePath\To\Source.tga
O -oPath\Of\NewFile.tga
O -m#(maximum number of colors)
O -d#(minimum difference for color to be unique)
Set 3:[]
Import palette of image. You must first use set 2 for this to work correctly, as well as use the same -m, -d commands
R -ePath\To\Source.tga
R -iPath\To\Palette.tga
O -oPath\Of\NewFile.tga
O -m#(maximum number of colors)
O -d#(minimum difference for color to be unique)
License[]
You can ignore the license that I have on this software. You only have to follow it if you are using it for a desktop application that you have made. You do still have to get credit though.