#!/usr/bin/env python # http://aethra-cronicles-remake.googlecode.com/svn-history/r4/trunk/export/sergroj/RSDef.pas # vcmi/client/CAnimation.cpp import struct from PIL import Image from collections import defaultdict import os def extract_def(infile,outdir): f = open(infile) # t - type # blocks - # of blocks # the second and third entry are width and height which are not used t,_,_,blocks = struct.unpack(" fw or tm > fh: print "margins (%dx%d) are higher than dimensions (%dx%d)"%(lm,tm,fw,fh) return False lineoffs = struct.unpack("<"+"I"*h, f.read(4*h)) for lineoff in lineoffs: f.seek(offs+32+lineoff) totalrowlength=0 while totalrowlength