-
Notifications
You must be signed in to change notification settings - Fork 84
OLED images and animations
ProffieOS can load images and animations from the SD card. Currently, the following events can play them: boot, font (when a new preset is selected), on (when blade is running), clsh, blst, force, and lock. In the future, there will probably be more things that will trigger loading OLED images or animations from the SD card. Note that ProffieOS uses the same code to locate image files as it uses for sound files. This means that multiple numbered files can be used, and one of them will be selected randomly to show each time.
Currently, two images formats are supported: BMP and PBM. In each case, the pictures must be 128x32 or 32x128 and only use one bit per pixel. (a.k.a. 1bpp, monochrome, two colors). In addition, PBMs must be saved in binary format, not ASCII. One thing to note is that bmp files will play inverted (black->white, white->black) so the files need to be saved with the colors "backwards" of how we want them to appear on the OLED display.
Simply using pbm instead avoids this.
During boot, ProffieOS will look in the first font directory of your font search path for "boot.bmp", "bootNNN.bmp", "boot.pbm" or "bootNNN.pbm" (where NNN is a number). During preset changes, ProffieOS will look in the font directory for "font.bmp", "fontNNN.bmp" "font.pbm" or "fontNNN.pbm", and so on for the other effects as well.
Images can be single frame stills, or they can be animated, and there are two ways to animate an image for the OLED display; looped, or non-looped.
To get started, save each animation frame as it's own image file, 128x32, and and name the files sequentially like font001.bmp font002.bmp font003.bmp etc... We'll use that naming convention for the following examples.
To make a looped animation, simply make the image taller, stacking frames vertically. For instance, if we make our image 128x64, that will be a 2-frame looped animation. 128x96 is a 3-frame looped animation, etc. This can be done manually in an image editor like Paint or Photoshop, and can be saved as either bmp or pbm, but remember to save as 1bpp monochrome.
We can make the process more automated by using command line tools mentioned below.
Download Imagemagick here : https://imagemagick.org/script/download.php
Once installed, using the "convert" command, we can stack the images appropriately, and convert to 1bpp monochrome in one step.
To stitch the files into one long animated vertical strip, use -append to stack them, and -monochrome to make them 1bpp, like this: (? is a wildcard so all numbered files will be processed)
convert -append -monochrome font???.bmp font.pbm
This file is now ready to play. The same format applies for on, boot, and the rest.
We can also use "convert" to break out an mp4 video file to individual bmp frames for stacking and looping
convert file.mp4 font.bmp
To make non-looped animations, we need to concatenate the files together into a .pbm file without the vertical stacking. We can use the same Imagemagick "convert" command as above, just without the -append option.
convert -monochrome font???.bmp font.pbm
On Linux or OSX, this can also be done with the "cat" command, however we need to either process files that are monochrome already, or convert the result of this:
cat font???.pbm >font.pbm
On windows, this can be done with the "copy" command, like so:
copy /b ?.bmp font.pbm
Also, using the Imagemagick "convert" program, we can directly convert an mp4 file into a non-looping pbm animation. For this, you should use a file pre-cropped to 128x32:
convert file.mp4 font.pbm
Cool Footer