解码 GIF 问题
对于个人项目,我正在创建一个静态 gif 解码器。到目前为止,一切都运行良好,除了我无法理解规范中的一个概念:
此块对于图像来说是必需的。 必须只有一个图像描述符 存在于数据流中的每个图像。无限数量的图像 每个数据流可能存在。 (规格)
每个数据流的图像数量不受限制?可以多于1个吗?我假设他们不是指动画 GIF,因为在同一规范中他们声明,他们不建议将 gif 用于动画。
我读过很多其他记录 gif 格式的网站,它们都声明了类似的内容。这是另一个链接:
GIF 中可能存在无限数量的图像。
有什么想法吗?
For a personal project I'm creating a static gif decoder. Everything works well so far, except I'm having trouble understanding one concept from the specification:
This block is REQUIRED for an image.
Exactly one Image Descriptor must
be present per image in the Data Stream. An unlimited number of images
may be present per Data Stream.
(Spec)
Unlimited images per data stream? There can be more than 1? I'm assuming they don't mean an animated GIF because in the same specification they state, that they don't recommend gif's be used for animation.
I've read a lot of other sites documenting the gif format and they all state something similar. Heres another link:
There might be an unlimited number of images present in a GIF.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GIF87a 不允许动画,但可以在 GIF 中启用多个图像。
这个想法是将大图片分解(为了更好的总压缩比)为几个矩形子图片,这些子图片绘制在最初填充背景颜色的公共画布上。每个子图片都有自己的 x、y、宽度、高度和调色板。例如,如果您正在绘制天文图片:地球和月球,这两个物体可能会在普通的大黑色画布上表示为两个小子图。它不是动画:两个子图片同时可见。
但这个美好的想法并没有得到软件(浏览器、图片查看器等)的支持,可能是由于这种非标准的方法。
从 GIF89a 开始,这些子图片被转换为动画帧。
GIF87a does not allow animation, but enables multiple images in GIF.
The idea was to decompose (for better total compression ratio) large picture into several rectangular subpictures drawn on a common canvas initially filled with background color. Every subpicture has its own x, y, width, height and palette. For example, if you are drawing astronomic picture: Earth and Moon, these two objects may be represented as two small subpictures on common large black canvas. It is not an animation: both subpictures are visible simultaneously.
But this beautiful idea was not supported by software (browsers, picture viewers, etc.), probably due to such non-standard approach.
Since GIF89a these subpictures were transformed into animation frames.
一个 GIF 文件中可以存在多个图像。是的,GIF 文件可以执行粗糙的动画,但通常不漂亮。
There can be more than one image present in a GIF file. Yes, GIF files can perform crude animation, but it's usually not pretty.