Saturday, September 8, 2012

Resize image to huge resolution with imagemagick

Recently I needed to print a 5-megapixel photo to roughly 1x2 meter size; the printing store wouldn't print it unless the resolution was at least 300 dpi, which, at that size, means a resolution of 500-megapixels!

Unfortunately, most image editing programs won't support so big files. One solution is to use ImageMagick from the command line. This should work in any platform supported by ImageMagick: Linux, Unix, MacOS and Windows.

First donwload and install ImageMagick from

From a terminal window, type the folowing command:

$ convert -monitor -limit memory 1GB -filter triangle input_file.jpg -resize 1000% output_file.jpg

The details of the different options can be found at, in short:
  • convert is the ImageMagick tool that can (among many other things) resize images.
  • -monitor is an option to display the progress of the operation. This is important to know what's happening, as the process may take several minutes.
  • -limit memory 1GB. This limits the amount of memory used by ImageMagick Without this, the file failed to save!
  • -filter triangle. This tells ImageMagick to use bilinear interpolation.
  • 1000% was the resize factor I needed to produce the 300 dpi image at 1x2m, you can specify other percentage, different horizontal and vertical factors or a target width or heigth (or both) in pixels.

Apply cool effects to your webcam with

Raspberry Pi: terminal "ls" colors for root in bash

To have the "ls" command output shown in colors for the root user, add the following line to the /root/.bashrc file.

alias ls='ls --color'

Note that, depending on the distribution you are using, this line (or something very similar) can already be present but commented out.

Apply cool effects to your webcam with