gifio – Access GIF-format images

Available on these boards
  • ATMegaZero ESP32-S2
  • Adafruit Camera
  • Adafruit Feather ESP32 V2
  • Adafruit Feather ESP32-S2 TFT
  • Adafruit Feather ESP32S2
  • Adafruit Metro ESP32S2
  • Adafruit QT Py ESP32 PICO
  • Adafruit QT Py ESP32S2
  • Artisense Reference Design RD00
  • BPI-Bit-S2
  • BPI-Leaf-S3
  • BPI-PicoW-S3
  • CrumpS2
  • Cytron Maker Feather AIoT S3
  • ESP 12k NodeMCU
  • ESP32-S2-DevKitC-1-N4R2
  • ESP32-S2-DevKitC-1-N8R2
  • ESP32-S3-DevKitC-1-N8R2
  • ESP32-S3-DevKitC-1-N8R8
  • ESP32-S3-EYE
  • Espressif ESP32-EYE
  • FeatherS2
  • FeatherS2 Neo
  • FeatherS2 PreRelease
  • FeatherS3
  • Franzininho WIFI w/Wrover
  • Gravitech Cucumber R
  • Gravitech Cucumber RS
  • HMI-DevKit-1.1
  • Hardkernel Odroid Go
  • HexKyS2
  • IoTs2
  • Kaluga 1
  • LILYGO TTGO T8 ESP32-S2 w/Display
  • MicroDev microS2
  • Oak Dev Tech PixelWing ESP32S2
  • ProS3
  • S2Mini
  • S2Pico
  • Saola 1 w/Wrover
  • Targett Module Clip w/Wrover
  • TinyPICO
  • TinyPICO Nano
  • TinyS2
  • TinyS3
  • Waveshare ESP32-S2-Pico
  • Waveshare ESP32-S2-Pico-LCD
  • nanoESP32-S2 w/Wrover

class gifio.GifWriter(file: Union[BinaryIO, str], width: int, height: int, colorspace: displayio.Colorspace, loop: bool = True, dither: bool = False)

Construct a GifWriter object

  • file – Either a file open in bytes mode, or the name of a file to open in bytes mode.

  • width – The width of the image. All frames must have the same width.

  • height – The height of the image. All frames must have the same height.

  • colorspace – The colorspace of the image. All frames must have the same colorspace. The supported colorspaces are RGB565, BGR565, RGB565_SWAPPED, BGR565_SWAPPED, and L8 (greyscale)

  • loop – If True, the GIF is marked for looping playback

  • dither – If True, and the image is in color, a simple ordered dither is applied.

__enter__() GifWriter

No-op used by Context Managers.

__exit__() None

Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.

deinit() None

Close the underlying file.

add_frame(bitmap: circuitpython_typing.ReadableBuffer, delay: float = 0.1) None

Add a frame to the GIF.

  • bitmap – The frame data

  • delay – The frame delay in seconds. The GIF format rounds this to the nearest 1/100 second, and the largest permitted value is 655 seconds.