sp0oks / Paletter

A small C program to change an image's colors to a fixed palette.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Paletter

A little pet project born out of quarantine boredom.

Do you have a nice picture and a cool palette and want to mix them up? Your solution is here! Use Paletter to make all colors in your image turn into one of the colors in the palette, minimizing their "color difference".

Compiling

With gcc installed on your machine, simply run:

make all

in the repository's root directory.

Usage

To use Paletter, you will need an image file and a CSV file that contains the hexcode of each color in your palette, separated by commas. Then, run:

./paletter <path-to-image-file> <path-to-csv-file> <output-file>

Or, if you use Windows, you might have to rename the file "paletter.exe", and then run:

paletter.exe <path-to-image-file> <path-to-csv-file> <output-file>

There are four supported output formats:

  • PNG (.png)
  • JPG (.jpg, .jpeg, .jpe, .jif, .jfif, .jfi)
  • BMP (.bmp, .dib)
  • TGA (.tga, .targa, .tpic)

Example

Using the following palette:

54478c,2c699a,048ba8,0db39e,16db93,83e377,b9e769,efea5a,f1c453,f29e4c

The original and paletted pictures are seen below:

I've put a number of palettes you can play with in the examples/palettes folder.

Libraries

I'm using three of Sean Barrett's amazing single-file libraries for image manipulation and dynamic arrays. Go check them out!

About

A small C program to change an image's colors to a fixed palette.


Languages

Language:C 99.9%Language:Makefile 0.1%