You can create short animated GIFs with the MEMENTO, perfect for sharing in text chats!
The Fancy Camera example will record a 15 frame, 240x176 pixel GIF* of about two seconds in duration each time you press and release the shutter button.
CircuitPython
Be sure you've installed CircuitPython on your MEMENTO before proceeding.
GIF Mode
To enter GIF mode, press the right button three times, you'll see the mode text highlight. By default it will be in JPEG mode.
Press the up button to cycle modes and choose GIF mode.
Make a GIF
Now, simply press and release the shutter button to record a two-second GIF animation. The GIF is saved automatically to the SD card. There is no on-camera preview, so you'll need to put the SD card in your computer's SD card reader to view it.
GIF Code
Here's the code snippet from the Fancy Camera code used for GIF creation -- you can use this to incorporate GIF recording into your own custom code:
if pycam.mode_text == "GIF": try: f = pycam.open_next_image("gif") except RuntimeError as e: pycam.display_message("Error\nNo SD Card", color=0xFF0000) time.sleep(0.5) continue i = 0 ft = [] pycam._mode_label.text = "RECORDING" # pylint: disable=protected-access pycam.display.refresh() with gifio.GifWriter( f, pycam.camera.width, pycam.camera.height, displayio.Colorspace.RGB565_SWAPPED, dither=True, ) as g: t00 = t0 = time.monotonic() while (i < 15) or not pycam.shutter_button.value: i += 1 _gifframe = pycam.continuous_capture() g.add_frame(_gifframe, 0.12) pycam.blit(_gifframe) t1 = time.monotonic() ft.append(1 / (t1 - t0)) print(end=".") t0 = t1 pycam._mode_label.text = "GIF" # pylint: disable=protected-access print(f"\nfinal size {f.tell()} for {i} frames") print(f"average framerate {i/(t1-t00)}fps") print(f"best {max(ft)} worst {min(ft)} std. deviation {np.std(ft)}") f.close() pycam.display.refresh()
Effects
The default GIF is created without effects applied, but you can get creative by picking built-in effects before shooting a GIF.
Press the right button to highlight the effect menu item, by default it is the Normal effect. Press up/down to cycle between the effects:
- Invert
- B&W
- Reddish
- Greenish
- Blueish
- Sepia
- Solarize
Then, shoot your GIF by pressing the shutter button as usual. Here are some examples:
NeoPixel Lighting
You can also add some NeoPixel lighting to your GIFs if you have the MEMENTO Camera Enclosure kit attached and connected over the JST cable.
Press the right button until LED LV is highlighted, then press up to pick a pre-set lighting level.
Press the right button again to highlight LED CLR, then press the up button so pick a pre-set color.
Here's an example of a weird guy with some magenta lighting highlights that look particularly odd inside his mouth. Freaky.
Post Processing
You can also use GIF editing tools (online or applications) to further edit your GIFs. Here's an example of creating a looping version of the basketball animation by doubling and re-ordering the frames:
* Pronounced GHIF as in. "Good grief, give me a break, go get some peanut butter for your graphics if you wanna say 'JIF'."
Don't @ me bro.
Text editor powered by tinymce.