Matrix-Inspired Digital Rain Project Packs a 127-Frame Animated GIF Onto a Raspberry Pi Pico's Flash
Designed for complete authenticity, this Matrix-style animated gadget squeezes a 135x240 127-frame animated GIF into just 2MB.
Pseudonymous developer "en0b" has released the source code for a Matrix-inspired digital rain animation, designed to run on a Raspberry Pi Pico and connected LCD display.
"[It's a] digital rain animation GIF with glow squeezed into a Raspberry Pi Pico and Pimoroni Pico Display," en0b explains of the project — "or how to actually use all flash memory on your Raspberry Pi Pico."
The project's hefty memory requirement stems from en0b's desire to get as authentic an effect as possible: Rather than recreating the iconic falling-characters with phosphor glow on the device itself, the programmer decided to create an animated GIF rendered on a more powerful device — but at 8MB, it wouldn't fit on the Raspberry Pi Pico's 2MB flash chip.
"Because I was too lazy to implement an existing file compression," en0b recounts, "I first just shortened and modified the animation manually (with GIMP you can modify each frame of a GIF). Unfortunately, the file was still too large with roughly 4MB, and then I decided to implement a primitive compression using just 16 custom colors (mainly different green tones and black).
"Then I used a python file to convert the GIF to a .h file of what color to use from the palette for each pixel and each frame. Like that I needed just four bits per pixel, and I could squeeze all 127 frames into the 2MB flash the Raspberry Pi Pico has on board."
Source code for the project, as well as a pre-compiled binary, is available on en0b's GitHub repository under an unspecified open source license; a Python tool for converting GIFs to switch out the animation is also provided, supporting animations of up to 127 frames.
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.