How to specify colours

You can use different colours specifications in ImageMagick ( you will need to escape the ( ) ).


Specification Format example Result
NameCyan Name colour patch
HEX #00ffff
You may need use ' around the colour '#00ffff'
HEX colour patch
RGBrgb\(0,255,255\) RGB colour patch
RGBArgba\(0,255,255,1\) RGBA colour patch
HSLhsl\(180,100,50\) HSL colour patch
HSLAhsla\(180,100,50,1.0\)
If black your browser does not support HSLA
HSLA colour patch
CMYKcmyk\(100,0,0,0\) CMYK colour patch
CMYKAcmyka\(100,0,0,0,100\) CMYKA colour patch

The code to produce the colour patchs, just replace the colour section with the examples above.

<?php
exec
("convert -size 50x20 xc:cmyka(100,0,0,0) cmyka.jpg"); 
?>

Note: Do not leave spaces between the colours; although the ImageMagick website says it will be OK. e.g. rgb\(255, 0, 0\) will not work but rgb\(255,0,0\) will work.