color-space-converter
Description
color-space-converter enables fast image color space conversion via vectorization from numpy arrays.
Installation
- via pip:
- install with
pip3 install color-space-converter
- type
color-space-converter -h
to the command line once installation finished
- install with
- from source:
- install Python from https://www.python.org/
- download the source using
git clone https://github.com/hahnec/color-space-converter.git
- go to the root directory
cd color_space_converter
- load dependencies
$ pip3 install -r requirements.txt
- install with
python3 setup.py install
- if installation ran smoothly, enter
color-space-converter -h
to the command line
Quick API Guide
Procedural usage:
from color_space_converter import rgb2yuv, yuv2rgb def treat_lum(img): yuv = rgb2yuv(img) yuv[..., 0] /= 2 rgb = yuv2rgb(yuv) return rgb
OOP style:
from color_space_converter import ColorSpaceConverter def treat_sat(img): obj = ColorSpaceConverter(img) hsv = obj.hsv_conv() hsv[..., 1] *= .5 rgb = obj.hsv_conv(hsv, inverse=True) return rgb
Command Line Usage
From the root directory of your downloaded repo, you can run the tool by
color-space-converter -s '../your_path/yourimage.png' -m 'gry'
on a UNIX system where the result is found at ../your_path/
. A windows equivalent of the above command is
color-space-converter --src=".\\your_path\\your_image.png" --method="gry"
Alternatively, you can specify the method or select your images manually with
color-space-converter --win --method='yuv'
More information on optional arguments, can be found using the help parameter
color-space-converter -h