Imagemagick深度转换 [英] Imagemagick depth convert
问题描述
持有 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- bit png。
As you can see, the conversion eps -> png creates 8-bit png.
好奇心加上 - 每股收益为16位!
Curiosity plus - the EPS is 16 bit!
$ 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)。
- why the
eps->png
conversion changes the bit-depth? - how to convert from eps to png to get 16-bit png? (as from tiff).
经过测试的@Rachel建议:
Tested @Rachel recommendation:
$ 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版本:
My ImageMagick version:
$ 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
如果有人想要测试,这是我的测试图像:
If anyone want test, here is my test image:
所以,@ Mark Setchell和@Rachel Gallen的推荐很好。 @Marks命令有效,所以键是PNG48。
So, @Mark Setchell and @Rachel Gallen's recommendation are good. @Marks command works, so the key is PNG48.
$ 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。我将在另一个问题中提问,为什么下一个:
Finally 16-bit png. What I will ask it in another question, why the next:
$ 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
应仅删除元数据,不更改图像本身。
8 bit again. And the -strip
should remove only metadata and should not change the image itself.
推荐答案
我认为你需要这些东西来获得16位PNG
I think you need something along these lines to get 16-bit PNGs
convert a.png -depth 16 PNG48:b.png
这篇关于Imagemagick深度转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!