Python脚本快速获取 swf 宽度和高度(像素),用法
python swfdimension.py test.swf
'''
filename swfdimension.py
SWF 文件格式
https://wwwimages2.adobe.com/content/dam/acom/en/devnet/pdf/swf-file-format-spec.pdf
获取单个文件长宽
python swfdimension.py onestab.swf
批量处理当前文件夹内所有swf文件
python swfdimension.py ./
© onestab csdn 2019-06
'''
import sys, os, zlib, lzma
def getswfdimension(fname):
with open(fname, 'rb') as f:
buf = f.read()
sig = buf[:3].decode('ascii')
d = None
if sig == 'FWS':
# uncompressed
d = buf[8:]
elif sig == 'CWS':
d = zlib.decompress(buf[8:])
elif sig == 'ZWS':
d = lzma.decompress(buf[8:])
if not d:
print('unknown file format')
return
nbits = d[0]>>3
bstr=''
for i in range(32):
bstr