不同图像文件格式示例

Tar*_*aro 1 file-format image image-processing

在我们自己的软件中,我们支持加载不同类型的图像,包括但不限于.bmp、.gif、.tiff、.jpg 和.png。

在代码中,我注意到某些图像可能正在使用颜色索引,但看起来我们的图像处理库之一缺少一些补丁(曾经丢失过)。

我想针对这种奇怪的图像格式测试我们的软件(我们正在加载 .png 和 .jpg 好吧),您能给我推荐一些图像集,我可以在其中下载许多具有不同保存选项的不同图像文件格式。

因此至少会包含颜色索引的 .png / .tiff / .bmp。

Mar*_*ell 5

正如 @piglet 建议的那样,您应该创建测试用例以确保覆盖范围。您可以使用ImageMagick之类的东西,这是一个非常基本的脚本,可以生成一堆不同格式的文件 - 当然,还有更多可能,但您需要指定自己的测试用例。

这将创建一个测试 JPEG 文件:

magick xc:red xc:lime +append \( xc:blue xc:magenta +append \) -append -resize 600x600 test.jpg
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如果您想要多种格式,这里有一个脚本:

#!/bin/bash
files=(test.gif test.jpg test.bmp PNG8:testPNG8.png PNG24:testPNG24.png PNG32:testPNG32.png PNG48:testPNG48.png PNG64:testPNG64.png test.tif)

for f in "${files[@]}"; do
   magick xc:red xc:lime +append \( xc:blue xc:magenta +append \) -append -resize 600x600 "$f"
done
Run Code Online (Sandbox Code Playgroud)

这是输出文件:

-rw-r--r--@ 1 mark  staff  1080138 14 Sep 09:26 test.bmp
-rw-r--r--@ 1 mark  staff   109366 14 Sep 09:26 test.gif
-rw-r--r--@ 1 mark  staff    24457 14 Sep 09:26 test.jpg
-rw-r--r--@ 1 mark  staff  2160264 14 Sep 09:26 test.tif
-rw-r--r--@ 1 mark  staff    62181 14 Sep 09:26 testPNG24.png
-rw-r--r--@ 1 mark  staff    68153 14 Sep 09:26 testPNG32.png
-rw-r--r--@ 1 mark  staff   545890 14 Sep 09:26 testPNG48.png
-rw-r--r--@ 1 mark  staff   550337 14 Sep 09:26 testPNG64.png
-rw-r--r--@ 1 mark  staff     6747 14 Sep 09:26 testPNG8.png
Run Code Online (Sandbox Code Playgroud)

以下是将所有测试图像拼接在一起:

在此输入图像描述

您可能需要循环浏览:

  • 格式,
  • 位深度(8,16,32),
  • 色彩空间,
  • 托盘化/非托盘化,
  • 透明/不透明,
  • 压缩类型,
  • 隔行扫描/非隔行扫描,
  • ... 等等