snibgo's ImageMagick pages

Colour wheels

We can draw some pretty colour wheels.

See also the closely-related Rainbow cluts.

setlocal enabledelayedexpansion

"%IM%convert" ^
  -size 100x300 gradient: -rotate 90 ^
  -distort Arc "360 -90 50" +repage ^
  -gravity center -crop 100x100+0+0 +repage ^
  -rotate -90 ^
  cwx_angular.png

"%IM%convert" -size 100x100 radial-gradient: -negate cwx_radial.png

"%IM%convert" -size 100x100 xc:gray(50%%) cwx_solid.png

set WHEELS=

for %%H in (HSL,HSB,HSI,HSV,HCL,HCLp,HWB) do (
  "%IM%convert" ^
    cwx_angular.png cwx_solid.png cwx_radial.png ^
    -combine ^
    -set colorspace %%H ^
    -colorspace sRGB ^
    ^( label:%%H -trim +repage ^
       -bordercolor White -border 2 ^) ^
    -gravity Center ^
    -append +repage ^
    +depth ^
    cwx_%%H.png

  set WHEELS=!WHEELS! cwx_%%H.png
)

%IM%convert %WHEELS% +append +repage cw_wheels.png

del %WHEELS%
cw_wheels.png

We can vary the middle channel, saturation, from zero to 100%.

setlocal enabledelayedexpansion

"%IM%convert" ^
  -size 100x300 gradient: -rotate 90 ^
  -distort Arc "360 -90 50" +repage ^
  -gravity center -crop 100x100+0+0 +repage ^
  -rotate -90 ^
  +depth ^
  cwx_angular.png

"%IM%convert" ^
  -size 100x100 radial-gradient: ^
  -negate ^
  +depth ^
  cwx_radial.png

set ROWS=
for /L %%P in (0, 10, 100) do (
  "%IM%convert" -size 100x100 xc:gray^(%%P%%^) cwx_solid.png

  set WHEELS=

  for %%H in (HSL,HSB,HSI,HSV,HCL,HCLp,HWB) do (
    "%IM%convert" ^
      cwx_angular.png cwx_solid.png cwx_radial.png ^
      -combine ^
      -set colorspace %%H ^
      -colorspace sRGB ^
      ^( label:"%%H %%P" -trim +repage ^
         -bordercolor White -border 2 ^) ^
      -gravity Center ^
      -append +repage ^
      +depth ^
      cwx_%%H.png

    set WHEELS=!WHEELS! cwx_%%H.png
  )

  %IM%convert %WHEELS% -set colorspace sRGB +append +repage +depth cwx_wheels_%%P.png
  set ROWS=!ROWS! cwx_wheels_%%P.png
)

del %WHEELS%

%IM%convert %ROWS% -append +repage cw_rows.png

del %ROWS%
del cwx_*.png
cw_rows.png

We can get a different style of colourwheel from Lab colorspace.

%IM%convert ^
  -size 200x200 ^
  xc:gray(75%) ^
  gradient: ^
  ( gradient: -rotate 90 ) ^
  -combine -set colorspace Lab ^
  -colorspace sRGB ^
  cw_lab.png
cw_lab.png

All images on this page were created by the commands shown, using:

%IM%identify -version
Version: ImageMagick 6.9.9-50 Q16 x64 2018-06-02 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib

Source file for this web page is colwheel.h1. To re-create this web page, execute procH1 colwheel.


This page, including the images, is my copyright. Anyone is permitted to use or adapt any of the code, scripts or images for any purpose, including commercial use.

Anyone is permitted to re-publish this page, but only for non-commercial use.

Anyone is permitted to link to this page, including for commercial use.


Page version v1.0 21-Jan-2014.

Page created 23-Aug-2018 17:37:29.

Copyright © 2018 Alan Gibson.