https://github.com/stevekm/image-sort
Program to sort images by average color values
https://github.com/stevekm/image-sort
image-processing pil pillow
Last synced: about 1 month ago
JSON representation
Program to sort images by average color values
- Host: GitHub
- URL: https://github.com/stevekm/image-sort
- Owner: stevekm
- License: gpl-3.0
- Created: 2019-04-14T05:21:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-21T17:43:47.000Z (almost 4 years ago)
- Last Synced: 2024-05-12T00:46:24.490Z (over 1 year ago)
- Topics: image-processing, pil, pillow
- Language: Python
- Homepage:
- Size: 24.2 MB
- Stars: 22
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# image-sort
[[Docker Hub](https://hub.docker.com/repository/docker/stevekm/image-sort)]
Program to sort images based on average color values. `imagesort.py` is able to:
- `print` a sorted csv format table of the average RGB (red, green, blue) and HSV (hue, saturation, value) attributes of each image
- create `thumbnail` output of supplied images with numeric filenames ordered by average RGB or HSV values
- create a `collage` output of all thumbnails of all supplied sorted images along with color information on each image's average RGB value
- create an animated `gif` that will quickly flip through all the sorted thumbnails
- perform multi-threaded parallel image processing when files are supplied in a directory
- adjust the size of output images along with the `key` value used for sorting (default: `"hue"`)
- supply a secondary image file with pixels to `ignore` amongst input images, for example to help remove the effects of unwanted background colors on the calculated average RGB values
## Examples
Example commands
- print table of values
```
./imagesort.py print assets/jpg/Animals-1/ --threads 2 --key red --ignore ignore-pixels-white.jpg
```- save a table of values, then read it back to create thumbnails, collage, and gif
```
./imagesort.py print assets/jpg/Animals-1/ --threads 4 --ignore ignore-pixels-white.jpg > data.csvmkdir -p output
./imagesort.py thumbnails data.csv --csv --output output/ -x 200 -y 200 --bar 60./imagesort.py collage data.csv --output collage.jpg --csv -x 200 -y 200 --bar 60 --ncol 5
./imagesort.py gif data.csv --csv --output image.gif -x 150 -y 150 --bar 50
```Example output
- `collage` output
- `gif` output

# Installation
Clone this repo
```
git clone https://github.com/stevekm/image-sort.git
cd image-sort
```## Install with `conda`
Install dependencies into a local `conda` installation in the current `image-sort` directory
```
make install# activate the conda env
source conda/bin/activate# deactivate it when you are done
conda deactivate
```### Testing
Run the test suite with
```
make test
```Run the set of example CLI commands with
```
make test-commands
```## Docker
If you have trouble installing the required dependencies, it can also be run with Docker.
```
docker run -v $PWD:$PWD --workdir $PWD stevekm/image-sort:latest imagesort.py --help
```