Category menu

ASCII camera with the Holga 120d

So now I’ve finished my digital Holga project, one of the things I wanted to do was to get a bit creative with it – so here’s my first attempt at an ASCII art generating camera.

Holga 120d ASCII text image

High contrast images work best.

This uses the ASCII art script written by Steven Kay, please visit his blog to find out more – I’ve modified the original script to use the python picamera library – this helps speed up the image resize. There’s also a timestamp added to the text file which uses the same script I wrote about in my previous Holga post.

If you just want to run Steven Kay’s script you’ll need the python imaging tools – install with

sudo apt-get install python-imaging

Here’s my modified script:

ASCII Art maker
Creates an ascii art image from an arbitrary image
Created on 7 Sep 2009

@author: Steven Kay

import time
import picamera
from PIL import Image
import random
from bisect import bisect

# greyscale.. the following strings represent
# 7 tonal ranges, from lighter to darker.
# for a given pixel tonal level, choose a character
# at random from that range.

greyscale = [
            " ",
            " ",

# using the bisect class to put luminosity values
# in various ranges.
# these are the luminosity cut-off points for each
# of the 7 tonal levels. At the moment, these are 7 bands
# of even width, but they could be changed to boost
# contrast or change gamma, for example.


#take photo

with picamera.PiCamera() as camera:

# open image and resize
# experiment with aspect ratios according to font"image.jpg")
im=im.resize((160, 75),Image.BILINEAR)
im=im.convert("L") # convert to mono

# now, work our way over the pixels
# build up str

for y in range(0,im.size[1]):
    for x in range(0,im.size[0]):

print str

date_string = time.strftime("%Y-%m-%d-%H:%M:%S")

text_file = open('image' + date_string + '.txt', "w")

There are lots of settings to tweak – the image above was generated by the script – and bear in mind this is designed to be viewed with black text on a white background. Perhaps I’ll see if I can dig out an old dot matrix printer from somewhere.

For a blog of ‘photos’ updated whenever I take them and am in range of WiFi check out:

This emails the ASCII art in HTML format to blogger whenever I take a photo (and the Pi Holga is in range of the internet).

For more about the Digital Holga check out my previous blog posts on the hardware and building the case.

, , , , ,


  1. Take photographs and convert them to ASCII on the Raspberry Pi | Raspberry Pi Pod - November 15, 2014

    […] Pete Taylor has extended his Holga camera project by using a script by Steven Kay to convert images into ASCII art. You can see Pete’s modified version of the script here. […]

  2. ASCII camera using a Holga 120d and Raspberry P... - November 16, 2014

    […] So now I’ve finished my digital Holga project, one of the things I wanted to do was to get a bit creative with it – so here’s my first attempt at an ASCII art generating camera.  […]

  3. Holga Goes Digital Thanks To A Raspberry Pi And Pete Taylor's Awesome DIY ASCII Art Hack - DIY Photography - November 30, 2014

    […] he had the idea for ASCII art, he employed python tools and a script by Steven Kay, which Taylor modified slightly. Once that was in place, Taylor was in business. Now, every time he takes an ASCII […]

Leave a Reply