Skip to main content
LPI Linux EssentialsRaspberry Pi

Image Manipulation on the Raspberry Pi using ImageMagick

By May 10, 2014September 12th, 2022No Comments

Still working though are major open source application for the LPI Linux Essentials topic 1.2 we are going to become acquainted with ImageMagick. Like GIMP we can work with images but here we can work on the command line. This is very good where we may need to convert the format or resolution of many images. We will see how easily it is to covert image formats as well as other manipulations.  The real importance here, as we all these applications, it to gain the appreciation of the tools the open source software can offer.

The reality is that we are learning both for the certification but also our own benefit. We can make use of these tools both at home and in the work place and at the fraction of the cost of other tools.

To install ImageMagick on the Raspberry Pi

sudo apt-get update
sudo apt-get install imagemagick

If you have a PNG format image that you want to convert to JPEG; this can be achieved from the command line:

convert file.png  file.jpeg

To resize an image to 150 pixels wide and have the height is adjusted to scale

convert file.png -resize 150 150-file.png

To resize image to 150 pixel high and allowing width to scale accordingly:

convert file.png -resize x150 150-file.png

This of course can be part of a batch process making this very powerful working with images you select:

for p in *.png ; do
  convert "$p" -resize 150 150-"$p"
done

Take the time to watch the video and find out more.