解释“背景颜色指数".在GIF规范中 [英] Interpretation of "background colour index" in GIF specification

查看:98
本文介绍了解释“背景颜色指数".在GIF规范中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您查看 GIF规范,然后搜索背景颜色索引",您将看到以下描述:

If you look in the GIF specification and search for "Background Color Index", you see the following description:

vii)背景颜色索引-全局颜色表的索引 背景颜色.背景色是用于 屏幕上未被图像覆盖的像素.如果全球 颜色表标志设置为(零),此字段应为零, 应该被忽略.

vii) Background Color Index - Index into the Global Color Table for the Background Color. The Background Color is the color used for those pixels on the screen that are not covered by an image. If the Global Color Table Flag is set to (zero), this field should be zero and should be ignored.

这里有一个歧义,即如果全局颜色表标志"设置为零并且忽略该字段,那么如果图像数据本身不存在,则GIF实际应具有的背景颜色是不确定的覆盖整个图像区域.之所以可能这样做,是因为每个图像数据块都独立指定了左/右/宽度/高度,并且不需要每个像素都必须由图像数据编码.

There is an ambiguity here, which is that if the "Global Color Table Flag" is set to zero and this field is ignored, then it is undefined what background colour of a GIF actually should be if the image data itself does not cover the entire image area. This possible because every image data block specifies left/right/width/height independently and there is no requirement that every pixel must be encoded by the image data.

我误解了吗?如果没有,那么在存在这种歧义的情况下,今天的GIF实现的实际行为是什么?

Am I misinterpreting this? If not, then in the presence of this ambiguity, what is the de facto behaviour of GIF implementations today?

推荐答案

例如,Safari使用黑色作为背景.使用Win10照片查看器很难分辨,因为它始终使用黑色背景. Chrome,IE和Edge使用白色. 在没有背景色且您需要一种背景色的情况下,规范并未定义行为.因此,尽管我投票认为透明是最明智的选择,但我想您会得到任意选择.

For the example, Safari uses black as the background. With Win10 photo viewer it's hard to tell, as it uses a black background anyway. Chrome, IE and Edge use white. The spec doesn't define the behaviour when there's no background colour and you need one, so I guess arbitrary choices is what you'll get, though I vote for transparent being the most sensible.

这篇关于解释“背景颜色指数".在GIF规范中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆