Permalink
Browse files

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.
  • Loading branch information...
1 parent 9d483a4 commit c6f596fd90bf132f82a7cd3e98783f87ff967f1c @aarmea aarmea committed Dec 21, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 anim_encoder.py
View
@@ -196,8 +196,12 @@ def generate_animation(anim_name):
packed = packed[0:allocator.num_used_rows]
misc.imsave(anim_name + "_packed_tmp.png", packed)
- os.system("pngcrush -q " + anim_name + "_packed_tmp.png " + anim_name + "_packed.png")
- os.system("rm " + anim_name + "_packed_tmp.png")
+ # Don't completely fail if we don't have pngcrush
+ if os.system("pngcrush -q " + anim_name + "_packed_tmp.png " + anim_name + "_packed.png") == 0:
+ os.system("rm " + anim_name + "_packed_tmp.png")
+ else:
+ print "pngcrush not found, output will not be larger"
@olliebennett
olliebennett Apr 18, 2014

I assume the word "not" is supposed to be "now"?!

+ os.system("mv " + anim_name + "_packed_tmp.png " + anim_name + "_packed.png")
# Generate JSON to represent the data
times = [t for t, f in frames]

0 comments on commit c6f596f

Please sign in to comment.