Skip to content

Commit c6f596f

Browse files
committed
Don't fail if pngcrush is not found
If pngcrush is not installed, don't delete the packed file and output it without compressing with pngcrush.
1 parent 9d483a4 commit c6f596f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

anim_encoder.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,12 @@ def generate_animation(anim_name):
196196
packed = packed[0:allocator.num_used_rows]
197197

198198
misc.imsave(anim_name + "_packed_tmp.png", packed)
199-
os.system("pngcrush -q " + anim_name + "_packed_tmp.png " + anim_name + "_packed.png")
200-
os.system("rm " + anim_name + "_packed_tmp.png")
199+
# Don't completely fail if we don't have pngcrush
200+
if os.system("pngcrush -q " + anim_name + "_packed_tmp.png " + anim_name + "_packed.png") == 0:
201+
os.system("rm " + anim_name + "_packed_tmp.png")
202+
else:
203+
print "pngcrush not found, output will not be larger"
204+
os.system("mv " + anim_name + "_packed_tmp.png " + anim_name + "_packed.png")
201205

202206
# Generate JSON to represent the data
203207
times = [t for t, f in frames]

0 commit comments

Comments
 (0)