Sunday, 7 June 2015

Creating images for the Astro-Pi HAT

My CodeClub loved their first session with the Astro-Pis. They particularly enjoyed displaying text on the LED matrix and were keen to create images like the space-invader that comes with the examples.

Obviously you can make these up directly in Python by making a list and loading it by the API, but this can be tricky in terms of colour design and involves lots of squinting.

When we made the TechWillSaveUs DIY gamers last year, they produced a simple Windows App for creating images for the monochrome matrix this device had.

I thought I'd try to knock up a similar application for Raspbian using pygame. There are a few programs for Windows and online that do a similar job, but I wanted something that would run natively on the Pi.

My app allows you to create patterns using the colours selected by the buttons on the righthand side.

You can then export this 8x8 pixel image to a png (filename is image8x8.png), print the corresponding Python list to the console or load it directly onto the Astro-Pi LED matrix.

You can also rotate the image once it is loaded on to the Astro-Pi.

It is a little rough around the edges at the moment although my son's efforts at beta testing seem to have helped my eliminate most of the glaring bugs.

If you want to give it a try, it is here on GitHub.


  1. well i guess i'm the only one who read the readme fie

  2. This was a very simple and easy to follow tutorial. I wish I had found this earlier when i deperately needed it for one of my projects! Good find though.

  3. You completed a few fine points there. I did a search on the subject and
    found nearly all persons will go along with with your blog picbear