actionscript-3 - 如何从 AS3 中的字节数组获取 GIF 图像尺寸?

标签 actionscript-3 flash air gif

如何从原始字节数组中获取 GIF 图像尺寸?

这是 related问题。我试图找出是否有一串包含宽度和高度的字节。

我找到了 this 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;

或者只使用 readShort 用于在不进行位移的情况下获取双字节值(16 位)<< ...

aWidth  = source.readShort();
aHeight  = source.readShort();

关于actionscript-3 - 如何从 AS3 中的字节数组获取 GIF 图像尺寸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41670780/

相关文章:

android - 如何在 Android 的 air 应用程序中运行 swf 文件

deployment - 如何使用智能电视将 AIR 文件部署到三星电视

ios - iphone 4 上 air 应用程序的性能问题

flash - 确定swf是否在 "debug"播放器或模式下

flash - 开始使用 Molehill,我应该开始学习什么 api?

flash - AS3 : ERROR 1046: Type was not found or was not a compile-time constant: Stage and TextField

javascript - 删除嵌入式 YouTube 视频上的注释

ios - 在 ActionScript Moblie iOS 应用程序中读取文本文件

actionscript-3 - e.target 和 e.currentTarget 之间的区别

ios - 在iOS5设备上测试Flash应用程序时模糊效果消失