Skip to content

Commit 7a87e13

Browse files
author
Sublime HQ Pty Ltd
committed
Merge pull request #4 from aarmea/master
Slightly friendlier to use on Windows
2 parents ca86866 + c6f596f commit 7a87e13

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

anim_encoder.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22
# Copyright (c) 2012, Sublime HQ Pty Ltd
33
# All rights reserved.
44

@@ -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)