117. How do I convert an image from RGB to CMYK?

The software ImageMagick can do this. This can also be done in Photoshop and other tools. But ImageMagick works in both Windows, macOS and Linux (Ubuntu etc) and also has an interface in plenty of programming languages. And it is free.
- Read more about sRGB and CMYK color model on Wikipedia.
- Read more about ICC profile (color profile) on Wikipedia.
- As an example we have a small sRGB PNG.
$ identify start.image.png start.image.png PNG 448x54 448x54+0+0 8-bit sRGB 4101B 0.000u 0:00.009 $
- First convert the sRGB PNG into a sRGB TIFF.
$ convert start.image.png start.image.tiff $
- Then convert the sRGB TIFF into a CMYK TIFF.
$ convert start.image.tiff -colorspace CMYK output.image.tiff $
- Confirm that the resulting image is a CMYK TIFF.
$ identify output.image.tiff output.image.tiff TIFF 448x54 448x54+0+0 8-bit CMYK 2376B 0.000u 0:00.000 $
The command line tool seems to work fine in Windows as well: