https://github.com/crowsonkb/gradient-maker3
A web application to generate color gradients using the CAM02-UCS colorspace.
https://github.com/crowsonkb/gradient-maker3
ciecam02 color color-science colormap gamut-mapping theano web-application
Last synced: about 2 months ago
JSON representation
A web application to generate color gradients using the CAM02-UCS colorspace.
- Host: GitHub
- URL: https://github.com/crowsonkb/gradient-maker3
- Owner: crowsonkb
- License: mit
- Created: 2017-03-24T16:27:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-18T12:48:45.000Z (about 8 years ago)
- Last Synced: 2025-01-28T22:44:25.600Z (4 months ago)
- Topics: ciecam02, color, color-science, colormap, gamut-mapping, theano, web-application
- Language: Python
- Homepage: http://gradient.kath.io/
- Size: 116 KB
- Stars: 1
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
gradient_maker
==============A web application to generate color gradients using the `CAM02-UCS `_ colorspace. (See also: `CIECAM02 and Its Recent Developments `_.)
Input colors are converted to the CAM02-UCS JMh (cylindrical) space and interpolation is performed. The resulting sequence is then converted to Jab (rectangular) format for gamut mapping. Projected gradient descent is employed, with two terms in the loss function: one term representing fidelity of an in-gamut Jab color in isolation to its ideal Jab color, the other penalizing deviations from the *first differences* of the ideal Jab color sequence. The second term keeps the sequence of colors spatially consistent. The CAM02-UCS forward transform was implemented in Theano for speed and Theano also differentiates the forward transform. The reverse transform is not needed explicitly. The resulting sequence of RGB colors lies inside the sRGB gamut.
Requirements: Python 3.5+, `aiohttp `_, `numpy `_, `scipy `_, `Theano `_, `ucs `_. See ``requirements.txt`` for details. Theano will need a C compiler and Python 3 development headers installed (on Debian/Ubuntu, the packages ``build_essential`` and ``python3-dev``). On MacOS, `Homebrew `_'s Python 3 will work.
Running it: ``python3 -m gradient_maker [--host HOST] [--port PORT]``. On first run, the ``srgb_to_ucs()`` and ``opfunc()`` functions need to be translated from Theano to C and compiled. This can take several minutes but the result is cached for future quick startup. For best performance, run it on the CPU (``THEANO_FLAGS=device=cpu``): Theano can compile it to use a GPU but this was found to run slower.