Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/LanceGin/haishoku
A development tool for grabbing the dominant color or representative color palette from an image
https://github.com/LanceGin/haishoku
design-tools dominant-colors palette pillow python3
Last synced: 3 months ago
JSON representation
A development tool for grabbing the dominant color or representative color palette from an image
- Host: GitHub
- URL: https://github.com/LanceGin/haishoku
- Owner: LanceGin
- License: mit
- Created: 2017-05-14T14:56:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-23T06:29:25.000Z (about 4 years ago)
- Last Synced: 2024-07-12T00:07:47.147Z (4 months ago)
- Topics: design-tools, dominant-colors, palette, pillow, python3
- Language: Python
- Homepage:
- Size: 923 KB
- Stars: 279
- Watchers: 14
- Forks: 28
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Haishoku
> `haishoku` is a JP word, it means palette in English.
Haishoku is a development tool for grabbing the dominant color or representative color palette from an image, it depends on `Python3` and `Pillow`.
### Feature
1. Grab the `dominant color` from a image.
2. Grab the representative `color palette` from a image.
3. From `v1.1.4`, Haishoku could load a image from remote url.
### Demo
![demo](http://orhcxc3kd.bkt.clouddn.com/haishoku.png)( original image's source: dribbble )
### Installation
```shell
pip3 install haishoku
```or maybe you should use
```shell
python3 -m pip install haishoku
```### Api
#### • loadHaishoku( image )
```python
from haishoku.haishoku import Haishoku
haishoku = Haishoku.loadHaishoku(image)
```it will return a Haishoku instance, and you can use `haishoku.dominant` and `haishoku.palette` to get the image's dominant color and color palette
> Also, you can use more immediately api to get them or show them temporarily, just like below:
#### • getDominant( image )
```python
from haishoku.haishoku import Haishoku
dominant = Haishoku.getDominant(image)
```returns: (R, G, B) `tuple`
#### • showDominant( image )
```python
from haishoku.haishoku import Haishoku
Haishoku.showDominant( image )
```it will open a temporary image to show the dominant color.
#### • getPalette( image )
```python
from haishoku.haishoku import Haishoku
palette = Haishoku.getPalette( image )
```returns: [(percentage, (R, G, B)), (percentage, (R, G, B)), ...] `Array` length <= 8
#### • showPalette( image )
```python
from haishoku.haishoku import Haishoku
Haishoku.showPalette( image )
```it will open a temporary image to show the palette.
### 中文文档
[中文文档](docs/document_zh.md)