Art and Tech Social: Command-line image manipulation with ImageMagick, 7th March

On 7th March I’ll be delivering a short workshop at BOM on using ImageMagick for image manipulation.

Join us for local food and drinks from Southside and get hands-on making with a bunch of like-minded folks interested in art and tech. This new monthly event aims to inspire emerging creatives and offer peer-to-peer tech support in a friendly, collaborative environment. Each workshop is different, featuring a different guest speaker and activities.

ImageMagick is a suite of command-line utilities for manipulating images. Most of its capabilities can be found in programs with a graphical user interface (GUI) such as GIMP or Photoshop. ImageMagick differs in its ability to use algorithms and programming to quickly batch process a number of images, add effects, convert between common and uncommon file formats, apply filters, generative special effects, and more!

In this workshop Antonio Roberts will introduce you to the using the terminal to perform tasks usually carried out by GUI programs. By the end participants will have learnt:

  • how to install ImageMagick
  • How to convert between file formats
  • How to view advanced metadata
  • How to apply a variety of effects to images
  • How to optimize files for print and internet
  • How to create animated gifs with only a few keystrokes

The workshop is free to attend. To take part you should bring a Mac or Linux computer. ImageMagick does 100% work on Windows but the way the terminal/command line works is very different from Unix systems. For those without a Mac or Linux computer please contact If you’re feeling brave you can install ImageMagick prior to the start of the workshop.

Emojify all the things

There’s no doubt that emoji is here to stay and will infiltrate your artwork, desktop, phone screens and inboxes if it hasn’t already done so. In a similar vein to ASCII art, recently apps have been released to convert pixels in images and video to emoji. Emoji Video and Emojify are two iOS apps that can convert content to emoji, with the former appearing to be able to do this in realtime with video.

In a time before emoji two popular libraries existed to do the same thing, only using text and colour blocks (y’know, ASCII). AAlib and libcaca are two popular open source libraries that have been used extensively.


Although the two aforementioned emojifying apps work really well, unfortunately there are not yet any open source libraries available to achieve the same effect. Until one is built I took it upon myself to spend a few hours making something that uses Imagemagick and the Twitter emoji set. It’s not nearly as efficient as the emojifying apps or libcaca/libaa, and cannot be used on live video, but as a short experiment I think it works nicely.

The script works by using symbol patterns for dithering. This process uses the frames in an animated gif to replace blocks of colour. As shown in the Imagemagick example any gif can be used. The first step to using the script finding an emoji icon set. The Twitter emoji set is really good and is released under a Creative Commons licence, but feel free to use whatever you want. Download this to your computer.

As mentioned before, this dithering method makes use of the frames from an animated gif. For true emojification all of the emjoi in the set could be converted into one gif, but that would result in a loss of colour, a huge file size and possibly epic processing times! For that reason I decided to pick six random emoji each time the script was run. With each element in place I now just executed the script. You’ll need to modify line three to point to the directory containing the emoji set.

Cat Eye emojified

Freudenberg sg Switzerland emojified

Ipomoea aquatica flower emojified

Studio portrait emojified

Not bad for a few hours of work!

If you’re starting to think that you’ve seen this aesthetic in my work before then you would be right. I have previously used this technique, instead using some randomly generated symbols, for the CóRM image set and some t-shirt/logo designs for NESkimos that I think were never used.

If anyone every creates an open source library for emojifying things I’d be happy to know about it 🙂


Streams of data

One of my overall goals is to find a way to databend live video. I’m sure there’s a way to do it with Processing and PureData but I’m not yet proficient in those programs so they’re out of the question for now. In the meantime I thought to try and hack the Echobender script to databend my webcam images.

>tonyg provides a great tutorial on how to convert live webcam images into audio, which I’ve used as a starting point for my hack.

The process for making it works is as follows:

  • Images from the webcam are saved to the computer
  • These are converted to a .bmp file then renamed to a .raw file
  • Sox applies an audio effect to the .raw file
  • The .raw file is converted back to a .bmp then to a .jpg
  • The updated webcam image is displayed to a window and updated once every second

Sound overly complicated? It probably is. Like the Echobender script you’ll need ImageMagick and Sox but we’ll also be using Webcam, which you can install via sudo apt-get install webcam

If you haven’t already, create a file called .webcamrc in your home directory (/home/yourusername) and enter this text into it:

delay = 0
text = “”

local = 1
tmp = uploading.jpg
file = webcam.jpg
dir = .
debug = 1

Now create a file called grabframe, place it in your home directory and fill it with this:


while [ ! -e webcam.jpg ]; do sleep 0.1; done
convert webcam.jpg frame.bmp
cp frame.bmp frame.raw
sox -r 482170 -e u-law frame.raw frame2.raw echos 0.8 0.9 5000 0.3 1800 0.25
convert -size 640x240 -depth 4 rgb:frame2.raw -trim -flip -flop output.bmp
convert output-0.bmp output.jpg

To start things running, open up three terminal instances:

  • In shell number one, run webcam.
  • In shell number two, run “while true; do ./grabframe ; done.
  • In shell number three, run display -update 1 output.jpg


I know it’s quite slow, but I haven’t yet found a way to update faster and it’ll still be restricted by the time it takes Sox/ImageMagick to perform their conversions.

Thanks again to tonyg, Imbecil and Mez for their help and inspiration


Myself and Mez recently finished a script called Echobender that automatically databends images.

Click to view on GitHub

To use it you’ll need:

  • A computer with Linux installed. I don’t have a Windows or Mac PC so I can’t test it on those
  • Sox. On Ubuntu you can install it via sudo apt-get install sox
  • Convert, which is part of ImageMagick. On Ubuntu you can install it via sudo apt-get install imagemagick

Once you have those installed just execute ./ from the terminal and then drop a .jpg or .bmp file into it. The output will be in a folder called “echo”.

If you look closely at the script you can see a way to convert any data into an image! I’ll leave that one up to you… Here’s the source code for all those interested:

Thanks to Imbecil‘s MPegFucker script for much of the inspiration.