Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to negate image using ImageMagick

📅 2018-Dec-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ imagemagick, invert, negate ⬩ 📚 Archive

The ImageMagick convert tool can be used to negate an image using the -negate and +negate options. -negate replaces every grayscale or RGB pixel with its inverted or complementary color. Use +negate when you want to restrict this operation to only work on grayscale pixels.

Example:

$ convert -negate foo.png inverted_foo.png

Tried with: ImageMagick 6.9.7 and Ubuntu 18.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧