有一个图片 in.png
。现在进行以下操作:
$ convert in.png -strip out.tiff #convert to tiff
$ convert out.tiff -strip out.png #and back
$ cmp in.png out.png
$#no output - the images has no difference - theyre same
$ identify in.png out.png
in.png PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
out.png[1] PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
现在尝试使用eps
。因此:
$ convert in.png -strip out2.eps #convert to eps
$ convert out2.eps -strip out2.png #back
而且这些图片是不同的。
$ identify in.png out.png out2.png
in.png PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
out.png[1] PNG 300x300 300x300+0+0 16-bit sRGB 1.65KB 0.000u 0:00.000
out2.png[2] PNG 300x300 300x300+0+0 8-bit sRGB 4c 321B 0.000u 0:00.009
正如您所看到的,将eps转换为png会创建8位png。
有趣的是 - EPS是16位!
$ identify out2.eps
out2.eps PS 300x300 300x300+0+0 16-bit sRGB 1.42KB 0.000u 0:00.000
问题:
- 为什么转换
eps->png
会改变位深度? - 如何从 eps 转换为 png 并获得 16 位的 png?(与 tiff 相同)。
编辑
测试了 @Rachel 的建议:
$ convert out2.eps -depth 16 out3.png
$ identify out3.png
out3.png PNG 300x300 300x300+0+0 8-bit sRGB 4c 518B 0.000u 0:00.000
再次提及 8 位。
我的 ImageMagick 版本:
$ convert --version
Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-06-01 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib djvu fftw fontconfig freetype gslib gvc jng jp2 jpeg lcms ltdl lzma pangocairo png ps tiff webp wmf x xml zlib
如果有人想测试,这是我的测试图片:
![test image](https://istack.dev59.com/V0EwS.webp)
$ convert out2.eps -depth 16 PNG48:out7.png
$ identify out7.png
out7.png PNG 300x300 300x300+0+0 16-bit sRGB 1.86KB 0.000u 0:00.000
最后,16位png格式。我将在另一个问题中提出询问,为什么会出现下面的情况:
$ mogrify -strip out7.png
$ identify out7.png
out7.png PNG 300x300 300x300+0+0 8-bit sRGB 4c 321B 0.000u 0:00.000
再次回到8位。而-strip
应该仅删除元数据,不应更改图像本身。