ImageMagick:转换不断将颜色空间更改为灰色。如何保留sRGB色彩空间? [英] ImageMagick: convert keeps changing the colorspace to Gray. How to preserve sRGB colorspace?

查看:336
本文介绍了ImageMagick:转换不断将颜色空间更改为灰色。如何保留sRGB色彩空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理脚本可将我的PNG-24(带透明度)图像转换为50%和25%的大小(用于移动开发)。通常这些图像中都有颜色,但现在我正在尝试转换没有颜色的图像,ImageMagick不断将颜色空间配置文件更改为灰色,这会在我正在使用的3d引擎(Unity)中弄乱我的图像。 / p>

我试图强制它使用TrueColor类型,colorspace sRGB和sRGB.icc配置文件(OSX附带的配置文件),但它似乎并不关心。它仍会将其更改为格雷。

 > convert old.png -profile srgb.icc -colorspace sRGB -type TrueColor new.png 
>识别* .png
old.png PNG 140x140 140x140 + 0 + 0 8位sRGB 3.68KB 0.000u 0:00.000
new.png PNG 140x140 140x140 + 0 + 0 8位sRGB 256c 2.33KB 0.000u 0:00.000

ImageMagick仍然将其识别为8位sRGB图像,但它放置256c 在它之后,我假设它意味着它已经减少到256色,我也不想要。当我在OSX Preview.app中查看图像时,它表示它正在使用灰色配置文件。图像在视觉上看起来也有很多不同。



这是我正在使用的图像: https://dl.dropbox.com/u/59304/old.png



那里这是一个重复的问题, ImageMagick将色彩空间缩小为灰色,但答案不起作用不幸的是,对我来说,我没有足够的声誉评论他的回答。我想我的情况有所不同,因为我使用的是PNG而不是JPG。

 版本:ImageMagick 6.8.0-7 2013- 01-02 Q16 http://www.imagemagick.org 
特点:OpenCL

编辑 - 在阅读其中一个答案中指定的ImageMagick论坛后,看起来只是将PNG32:或PNG24:添加到输出文件中解决问题。

解决方案

我会查看Imagemagick论坛;这里有一篇文章可能有所帮助。
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=22654&p=94555&hilit=sRGB+png#p94555



我没有对png图像做任何特别的事情,但从我看到的有很多不同类型的png。


I have a batch script that converts my PNG-24 (with Transparency) images to 50% and 25% size (for mobile development). Usually these images have colors in them but now I am trying to convert an image that has no colors and ImageMagick keeps changing the colorspace profile to "Gray", which messes up my image in the 3d engine I'm using (Unity).

I have tried forcing it to use type TrueColor, colorspace sRGB, and the sRGB.icc profile (the one included with OSX) but it doesn't seem to care. It still changes it to Gray.

> convert old.png -profile srgb.icc -colorspace sRGB -type TrueColor new.png
> identify *.png
  old.png PNG 140x140 140x140+0+0 8-bit sRGB 3.68KB 0.000u 0:00.000
  new.png PNG 140x140 140x140+0+0 8-bit sRGB 256c 2.33KB 0.000u 0:00.000

ImageMagick still identifies it as an 8-bit sRGB image but it puts "256c" after it which I'm assuming means it has reduced it down to 256 colors, which I don't want either. When I look at the image in OSX Preview.app, it says it is using the Gray color profile. The image also visually looks a lot different.

Here is the image I'm using: https://dl.dropbox.com/u/59304/old.png

There is a duplicate question here, ImageMagick Reduces Colorspace to Gray, but the answer does not work for me and I don't have enough reputation to comment on his answer, unfortunately. I imagine my case is different because I'm using PNG and not JPG.

Version: ImageMagick 6.8.0-7 2013-01-02 Q16 http://www.imagemagick.org
Features:  OpenCL 

edit- After reading the ImageMagick forums as specified in one of the answers, it looks like just prepending PNG32: or PNG24: to the output file solves the problem.

解决方案

I would check out the Imagemagick forum; there is a post here that may be of help. http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=22654&p=94555&hilit=sRGB+png#p94555

I do not do anything special with png images but from what I see there are lots of different types of png.

这篇关于ImageMagick:转换不断将颜色空间更改为灰色。如何保留sRGB色彩空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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