Skip to content

A Python program I wrote as practice with Pillow.

Notifications You must be signed in to change notification settings

xzy-10/PaletteRipper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PaletteRipper

A Python 3 program I wrote to practise with the Pillow library.

PaletteRipper is a script which analyses an image and outputs a colour palette from it. The quality of the colour palette as well as the number of colours are dependent on the individual parameters given.

Usage


python3 PaletteRipper.py [MODE] [INPUTFILE] [OUTPUTFILE] [QUALITY/NUMBER] (SORTED)

Modes: --fullset --> Isolates all unique colours and reassembles them in a new image.

--simplified --> Chooses the most common colours and reassembles them in a new image.

Modifiers:

[QUALITY] --> The number of times to divide the picture width and height by. A higher number corresponds to fewer colours. This is used when --fullset is chosen.

Essentially, if you have a larger number, the picture will be shrunk further by that scale factor and the colour generated will be lesser. Use 1 for maximum quality.

SORTED (Y/N) --> Determines whether the full palette should be sorted. Only works for --fullset.

NUMBER --> The maximum number of colours to put in the new image. Note that this may not be possible for large numbers. This is used when --simplified is chosen.

INPUTFILE --> The name of the picture to extract the colour palette from.

OUTPUTFILE --> The name of the picture where the colour palette will be placed. Please save as PNG to avoid compression.

Examples


Original Image:

denis-degioanni-9wH624ALFQA-unsplash

Photo by Denis Degioanni on Unsplash

Full set with highest quality (QUALITY = 1) sorted:

fullset1

Full set with QUALITY = 5 sorted:

fullset5

Full set with highest quality (QUALITY = 1) unsorted:

fullset1unsorted

Simplified Set with 15 colours (each colour is one pixel in size):

simplifiedset15

About

A Python program I wrote as practice with Pillow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages