Convert from grayscale to sRGB colorspace

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
q3cpma
Posts: 5
Joined: 2015-08-26T13:45:40-07:00
Authentication code: 1151

Convert from grayscale to sRGB colorspace

Post by q3cpma »

The tast I'm trying to accomplish isn't extraordinary but i'm failing hard at it. I've seen some forum topics, but their solutions didn't work for me.

Code: Select all

convert -colorspace sRGB -define "colorspace:auto-grayscale=off" -define "png:color-type=6" in.png out.png
Didn't work. Also tried with

Code: Select all

-set "colorspace:auto-grayscale" "false"
Thanks for reading.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert from grayscale to sRGB colorspace

Post by fmw42 »

There is no equivalent -define to the -set option. I believe that is only available in current release, IM 6.9.2-0. You do not mention your version of IM nor platform.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert from grayscale to sRGB colorspace

Post by snibgo »

In modern versions of IM, grayscale is already in sRGB colorspace, meaning that it has a complex gamma curve that is roughly gamma=2.2.

What do you really want to do? How do you know you are not already doing it?
snibgo's IM pages: im.snibgo.com
q3cpma
Posts: 5
Joined: 2015-08-26T13:45:40-07:00
Authentication code: 1151

Re: Convert from grayscale to sRGB colorspace

Post by q3cpma »

Sorry, I was using an outdated version. I needed PNG24 output to go with Vapoursynth's IM plugin.

Using

Code: Select all

convert -colorspace sRGB -set "colorspace:auto-grayscale" "false" in.png PNG24:out.png
worked.

Also, it looks like the -define option is listed here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert from grayscale to sRGB colorspace

Post by fmw42 »

q3cpma wrote:Also, it looks like the -define option is listed here.
I recently asked the developer if there was a -define equivalent. He told me no. So I either misunderstood or he has recently added it.
q3cpma
Posts: 5
Joined: 2015-08-26T13:45:40-07:00
Authentication code: 1151

Re: Convert from grayscale to sRGB colorspace

Post by q3cpma »

Looks like it works too with -define (identify -format '%[colorspace]' out.png gives me sRGB).
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Convert from grayscale to sRGB colorspace

Post by dlemstra »

I recently asked the developer if there was a -define equivalent. He told me no. So I either misunderstood or he has recently added it.
Or he works too much with IM7 :) This did not work in IM7 but does in IM6. We are now investigating how we can fix it in IM7.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply