Skip to content

Commit

Permalink
Don't fail if pngcrush is not found
Browse files Browse the repository at this point in the history
If pngcrush is not installed, don't delete the packed file and
output it without compressing with pngcrush.
  • Loading branch information
aarmea committed Dec 21, 2012
1 parent 9d483a4 commit c6f596f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions anim_encoder.py
Expand Up @@ -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"

This comment has been minimized.

Copy link
@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]
Expand Down

0 comments on commit c6f596f

Please sign in to comment.