Imagemagick深度转换

Imagemagick深度转换,image,image-processing,imagemagick,Image,Image Processing,Imagemagick,在.png中有一个imgage。现在做下一步: $ 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 3

在.png中有一个imgage
。现在做下一步:

$ 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
$ mogrify -strip out7.png
$ identify out7.png 
out7.png PNG 300x300 300x300+0+0 8-bit sRGB 4c 321B 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

好奇加-每股收益是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
如果有人想要测试,以下是我的测试图像:

最终的 所以,@Mark Setchell和@Rachel Gallen的推荐很好@Marks命令起作用,所以键是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。下一步我将要做什么:

$ 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
$ 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
应该只删除元数据,而不应该更改图像本身。

我认为您需要一些类似的东西来获得16位PNG

convert a.png -depth 16 PNG48:b.png

我认为,从目前的情况来看,你可以做到

   convert -depth 16 image.eps image2.png[16]
语法是

   convert [ options … ] file [file …] file
表示“使用文件名后括号中的可选索引指定多分辨率图像格式(如Photo CD(如img0001.pcd[4])的所需子图像或MPEG图像的范围(如video.mpg[50-75])”


因此,可能会将[16]放在image2.png之后,因此应该首先转换
eps->png
(获取8位),然后再次从8位png转换为16位png?这并不意味着在
eps->png
上的损失?我只是在说明生成16位(或48位)png的概念。我想你可以把这些参数和开关直接放在EPS->PNG转换上。好吧-再次测试你没有放在PNG16:option中,它创建了一个名为:
PNG16:out6.PNG
的文件,标识打印:
PNG16:out6.PNG 300x300 300x300+0+0 8位sRGB 4c 518B 0.000u 0:00.000
。我的ImageMagick有问题吗?:)是的,一小时内尝试了许多变体,但没有得到任何好结果。根据ImageMagick不支持16位PNG!!!陛下但是从tiff文件转换是可行的-参见第一个示例。很好的一点-解决方案是PNG16,需要使用PNG48和@Mark推荐。谢谢