You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
840 B

#!/usr/bin/env python3
import blup.frame
import blup.animation
import blup.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)