Creating An Image Format For Embedded Hardware

Whether its one of those ubiquitous little OLED displays or a proper LCD panel, once you’ve got something a bit more capable than the classic 16×2 character LCD wired up to your microcontroller, there’s an excellent chance you’ll want to start displaying some proper images. Generally speaking that means you’ll be working with bitmap files, but as you might expect when pushing a decades-old file format into an application it was never intended for, things can get a little messy. Which is why [gfcwfzkm] has created the Portable Image File (PIF) format.

This low-overhead image format is designed specifically for microcontrollers, and can be decoded on devices with at least 60 bytes of free RAM. Images stored with PIF not only require fewer computational resources to process, but equally important, take up less space on flash. The format supports both color and monochrome images, and the GitHub repo even includes a graphical Python 3.10 tool that lets you convert your images to either .pif files or a .h header file for embedding directly into your C code.

[gfcwfzkm] has provided some source code to show you how to get the PIF library up and running, but as of the time of this writing, there isn’t any example code for using PIF within the Arduino environment. That’s no big deal for the old hands in the audience, but we’re interested in seeing how the community can make use of this file format once it’s available in a bit more beginner-friendly package. It’s one of the final unchecked items on the todo list though, so it shouldn’t be long now.

Of course nothing isĀ wrong with using bitmaps to display images in your microcontroller projects, and there’s a certain advantage to fiddling around with the well-known image format. But if a new file type is all it takes to speed up access times and cram a few more images onto the chip, we’re definitely ready to upgrade.

Legacy Digital Photos, With A Side Of Murphy’s Law

[Dave Madison] came across some old digital photos, and in his quest to access them, he ran into quite a few challenges. The saga brings to mind both Murphy’s Law, and while [Dave] prevailed in the end, it required quite a few more steps than one might expect.

The one smooth part of the process was that Konica’s proprietary software had a handy JPEG export feature.

Here’s the scene: in the late 90s, Konica partnered with photo shops to provide a photo scanning service, delivering digital scans of film photos on 3.5″ floppy disks, and that’s exactly what [Dave] had to work with. The disks were in good condition, and since modern desktop computers still support floppy drives and the FAT filesystem, in theory all one needs to do is stick disks into the reader one at a time in order to access the photos.

Sadly, problems started early. A floppy drive is revoltingly slow compared to any modern storage device, so [Dave]’s first step was to copy all of the files to his machine’s local storage before working on them. This took a bit of wrangling to deal with 8.3 format file names and avoid naming collisions across disks while still preserving some metadata such as original creation date. It was nothing a quick python script couldn’t handle, but that soon led to the next hurdle.

The photos in question were in an obsolete and proprietary Konica .KQP format. [Dave] went through a number of photo viewing programs that claimed to support .KQP, but none of them actually recognized the images.

Fortunately, each disk contained a copy of Konica’s proprietary “PC PictureShow” viewer, but despite having a variety of versions dated between 1997 and 2001 (making them from the Windows 98 and Windows ME eras) [Dave] could not get any version of the program to run in Windows 10, even with compatibility mode for legacy programs enabled. The solution was to set up a Windows XP virtual machine using Oracle’s Virtualbox, and use that to ultimately run PC PictureShow and finally access the photos. After all that work, [Dave] finally had a stroke of luck: Konica’s software had a handy feature to export images in JPEG format, and it worked like a charm.

In the end, [Dave] was able to save 479 out of the 483 images on the old floppy disks, with a reminder that proprietary formats are a pain. The disks and images may have been over twenty years old, but the roots of digital imaging go considerably further back than that. Take a few minutes out your day to read a bit about Russell Kirsch and the first digitized image, that of his three-month old son in 1957.