jpg_test.py

Draw a full screen jpg using the slower but less memory intensive method of blitting each Minimum Coded Unit (MCU) block. Usually 8x8 pixels but can be other multiples of 8.

../_images/bluemarble.png

bigbuckbunny.jpg (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org

 1"""
 2jpg_test.py
 3===========
 4
 5    Draw a full screen jpg using the slower but less memory intensive method
 6    of blitting each Minimum Coded Unit (MCU) block. Usually 8x8 pixels but can
 7    be other multiples of 8.
 8
 9    .. figure:: /_static/bluemarble.png
10      :align: center
11
12
13    bigbuckbunny.jpg (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org
14"""
15
16import gc
17import time
18import gc9a01
19import tft_config
20
21
22def main():
23    """
24    Decode and draw jpg on display
25    """
26    gc.enable()
27    gc.collect()
28
29    tft = tft_config.config(tft_config.TALL)
30
31    # enable display and clear screen
32    tft.init()
33
34    # cache width and height
35    width = tft.width()
36    height = tft.height()
37
38    # cycle thru jpg's
39    while True:
40        for image in ["bigbuckbunny.jpg", "bluemarble.jpg"]:
41            tft.jpg(image, 0, 0, gc9a01.SLOW)
42            time.sleep(5)
43
44
45main()