The ImageMagickconvert 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.
The display program of ImageMagick is useful when you are at the shell and need to quickly view one or a few images. It can also be used to apply many of the image processing operations available in ImageMagick on an image and view it. This viewer is extremely light and great for checking some images quickly on a remote computer over SSH.
If you do not have ImageMagick, installing it is easy:
$ sudo apt install imagemagick
To view a specific image:
$ display foo.jpg
To view all the JPEG files in current directory:
$ display *.jpg
To display all image files in current directory:
$ display *
If you know that you will not be changing the images, but just viewing them, then open them in immutable mode:
$ display -immutable *.jpg
Press F1 to view help about the mouse operations and keyboard operations available in this program.
Some of the keyboard shortcuts I frequently use:
Space: Next image
Backspace: Previous image
/: Rotate by 90 degrees
<: Zoom out
>: Zoom in
I use image viewer programs all day long to examine images captured from different sources. I was curious to see how much memory different viewers used. This might help in picking the right image viewer for a resource constrained system.
I have considered only simple image viewers, which allow you to view one or multiple images. Editing features are not really needed. The image viewers I considered were:
Eye of GNOME (eog): This is the default image viewer on Ubuntu.
Xfe: A lean file manager that can also be used to view images.
Feh: A minimal image viewer.
ImageMagick Display: Can only display a single image in a X window.
I looked at resident memory (RES) that is the actual RAM used by the viewer. I also looked at virtual memory (VIRT), since the viewer might require the OS to load many libraries.
The results are shown above. It can be clearly seen that Feh does pretty well and is my choice for a minimal image viewer.
PDF, SVG, PNG and many other image formats can have a transparent background. Sometimes, you might want to set the background color in image files. This can be done easily using the -background and -flatten options.
For example, to convert a PDF to JPG file and set the background color in the resulting file to white: