1.2*_*tts 1 air flash gif actionscript-3
如何从原始字节数组中获取GIF图像尺寸?
这是相关的问题.我试图找到是否有一个包含宽度和高度的字节字符串.
我在GIF格式上找到了这个页面,但我不确定如何破译它.它看起来像位置6和位置8包含宽度和高度?
我想这就是你要找的东西:http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp
字节6-7(基于0的索引)表示宽度,字节8-9表示高度.在这种情况下:
var source:ByteArray;
var aHeight:int;
var aWidth:int;
source.position = 6;
aWidth = source.readUnsignedByte();
aWidth += source.readUnsignedByte() << 8;
aHeight = source.readUnsignedByte();
aHeight += source.readUnsignedByte() << 8;
Run Code Online (Sandbox Code Playgroud)
或者只是readShort用于获得双字节值(16位)而无需移位<<...
aWidth = source.readShort();
aHeight = source.readShort();
Run Code Online (Sandbox Code Playgroud)