Skip to main content

HSV project

Why installing HSV :

This library offers fast conversion tools such as (HSV to RGB ) and (RGB to HSV) 
ported into cython for better performances 

Project description :

Conversions between color systems (cython library)
This module defines bidirectional conversions of color values between colors
expressed in the RGB (Red Green Blue) color space used in computer monitors and three
HLS (Hue Lightness Saturation).

Installation

pip install HSV

How to?

from HSV.hsv import rgb_to_hsv, hsv_to_rgb

if __name__ == '__main__':
    ONE_255 = 1.0 / 255.0
    r, g, b = 25, 60, 128
    print("\nOriginal RGB values (R:%s, G:%s, B:%s)\n" % (r, g, b))
    
    h, s, v = rgb_to_hsv(r * ONE_255, g * ONE_255, b * ONE_255)
    
    print("HSV values (H:%s, S:%s, V:%s)" % (h * 360.0, s * 100.0, v * 100.0))
    
    r, g, b = hsv_to_rgb(h, s, v)
    
    print("Retrieved RGB values (R:%s, G:%s, B:%s)\n" % (r * 255.0, g * 255.0, b * 255.0))

Building cython code

If you need to compile the Cython code after changing the files hsv.pyx or hsv.pxd or
the external C code please proceed as follow:

1) open a terminal window
2) Go in the main project directory where (hsv.pyx & hsv.pxd files are located)
3) run : python setup_hsv.py build_ext --inplace

If you have to compile the code with a specific python version, make sure
to reference the right python version in (c:\python setup_hsv.py build_ext --inplace)

If the compilation fail, refers to the requirement section and make sure cython
and a C-compiler are correctly install on your system.
- A compiler such visual studio, MSVC, CGYWIN setup correctly on your system.
  - a C compiler for windows (Visual Studio, MinGW etc) install on your system
  and linked to your windows environment.
  Note that some adjustment might be needed once a compiler is install on your system,
  refer to external documentation or tutorial in order to setup this process.
  e.g https://devblogs.microsoft.com/python/unable-to-find-vcvarsall-bat/

Credit

Yoann Berenguer

Dependencies :

cython >= 0.28
setuptools>=49.2.1

License :

MIT License

Copyright (c) 2019 Yoann Berenguer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Timing :

python
Test with 1000000 iterations

This library
rgb_to_hsv per call 2.22e-07 overall time 0.22196 for 1000000
hsv_to_rgb per call 1.156e-07 overall time 0.11563 for 1000000

Colorsys library
rgb_to_hsv per call 9.631e-07 overall time 0.96312 for 1000000
hsv_to_rgb per call 4.587e-07 overall time 0.45866 for 1000000

Metadata

Release files for HSV 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for HSV 1.0.2
File Size Uploaded
HSV-1.0.2.tar.gz 59.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for HSV 1.0.2
File
HSV-1.0.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
HSV-1.0.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
HSV-1.0.2-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
HSV-1.0.2-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
HSV-1.0.2-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details

Total release size: 253.2 kB

Release files / HSV-1.0.2.tar.gz

Download URL HSV-1.0.2.tar.gz
Size 59.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8e61157df6d9398b4ebdcebfaab5f19bdf887b09237e2c570ba45895db94e4ce
BLAKE2b-256 checksum
How to use checksums
038e5f3a590598a061eb7b6d440430e1117b45072c22c1ba8c7ba6a05a927cc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / HSV-1.0.2-cp310-cp310-win_amd64.whl

Download URL HSV-1.0.2-cp310-cp310-win_amd64.whl
Size 38.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
4bcca34f36668156c562dcef9823f851755b5c6e6a48cd124516af226ff8191c
BLAKE2b-256 checksum
How to use checksums
588d2a6303ae4c14bd5af074ea20018f31c7a12ac6e5159a5de5d790ac87dd89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / HSV-1.0.2-cp39-cp39-win_amd64.whl

Download URL HSV-1.0.2-cp39-cp39-win_amd64.whl
Size 38.8 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
964b6a560a470a414a449439510defcecf788936cc056e191c79e851a184f9c1
BLAKE2b-256 checksum
How to use checksums
c67e020f5dcaab13319bf16d7d7165d08ecf4b00e3c8612ecfe90ae4d70585a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / HSV-1.0.2-cp38-cp38-win_amd64.whl

Download URL HSV-1.0.2-cp38-cp38-win_amd64.whl
Size 38.9 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
25e9857ff6776a55839b4bfeb3b37ba5db331655f5643962cabf9b45ddc6b7a5
BLAKE2b-256 checksum
How to use checksums
b9a625785e815e6996d6d7e1c2d9f5eb5132ec9759616fadac24f34878460c14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / HSV-1.0.2-cp37-cp37m-win_amd64.whl

Download URL HSV-1.0.2-cp37-cp37m-win_amd64.whl
Size 38.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
663379a326a0cad763b714cc26e4d302979d1d475ada95dea273bfdd240e8ee2
BLAKE2b-256 checksum
How to use checksums
41b3e427a852baee12b41c59b12a7e7694e1c523457e4db0ed2f45f7f6f44306
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / HSV-1.0.2-cp36-cp36m-win_amd64.whl

Download URL HSV-1.0.2-cp36-cp36m-win_amd64.whl
Size 38.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
61b6f192504e930816c67284f76afe8eb67ada6af87b78a1397c81e66a0e6cbc
BLAKE2b-256 checksum
How to use checksums
e8b2e165640badfd9e6157f9a0ea494c72d67e186038c45d9a5dba47107d1262
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release history Release notifications | RSS feed

This release

1.0.2 This release

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page