Skip to content

Commit 42b8c8a

Browse files
authored
Merge pull request #20 from makermelissa/master
Removed unnecessary fill from animated gif player
2 parents 8af2cf6 + 017fd96 commit 42b8c8a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/is31fl3731_pillow_animated_gif.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#display = adafruit_is31fl3731.Matrix(i2c)
2424
# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix
2525
display = adafruit_is31fl3731.CharlieBonnet(i2c)
26-
display.fill(0)
2726

2827
# Open the gif
2928
if len(sys.argv) < 2:
@@ -40,11 +39,14 @@
4039

4140
# Get the autoplay information from the gif
4241
delay = image.info['duration']
43-
loops = image.info['loop']
4442

45-
# Adjust loop count (0 is forever)
46-
if loops > 0:
47-
loops += 1
43+
# Figure out the correct loop count
44+
if "loop" in image.info:
45+
loops = image.info['loop']
46+
if loops > 0:
47+
loops += 1
48+
else:
49+
loops = 1
4850

4951
# IS31FL3731 only supports 0-7
5052
if loops > 7:

0 commit comments

Comments
 (0)