Browse Source

added sd_to_hd.py

feature/balanceutils
Fr3deric 8 years ago committed by Frederic
parent
commit
bebeb6932f
  1. 28
      sd_to_hd.py

28
sd_to_hd.py

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import blup.frame
import blup.animation
import writebml
import sys
if len(sys.argv) != 3:
print('usage: %s INFILE OUTFILE' % (sys.argv[0]), file=sys.stderr)
sys.exit(1)
infname = sys.argv[1]
outfname = sys.argv[2]
anim = blup.animation.load(infname)
dim = blup.frame.FrameDimension(22, 16, 256, 3)
newanim = blup.animation.Animation(dim)
for f in anim:
newf = blup.animation.AnimationFrame(dim, f.delay)
for x in range(f.dimension.width):
for y in range(f.dimension.height):
newf.setPixel(x + 2, y*2, tuple(map(lambda x: int((x/anim.dimension.depth)*dim.depth), f.getPixel(x, y))))
newf.setPixel(x + 2, y*2 + 1, tuple(map(lambda x: int((x/anim.dimension.depth)*dim.depth), f.getPixel(x, y))))
newanim.addFrame(newf)
writebml.writeBml(newanim, outfname)
Loading…
Cancel
Save