Once again the same issue. Convering grayscale PNM to PNG makes the image dark. Apparently messed up colorspace conversion (linear vs. non linear).
All I want is the EXACT pixel values in the PNM to also be available in the PNG.
I've found
This: viewtopic.php?f=4&t=21269
and this: https://www.imagemagick.org/discourse-s ... hp?t=21275
However, no solutions proposed in those threads of work for me:
convert in.pnm -colorspace sRGB out.png
convert in.pnm -colorspace RGB -colorspace out.png
out.png is always darker.
Current shitty workaround:
convert in.pnm -gamma 2.2002200220022003 out.png
where 2.2 is 1 / 0.4545. While this is close, it doesn't give me the exact pixel values. I really, really, really, really need the EXACT values, no conversion nonsense. How can I do this? I would like to attach example files, but apparently I can't in this forum...
Grayscale too dark
-
- Posts: 3
- Joined: 2016-04-15T13:12:17-07:00
- Authentication code: 1151
-
- Posts: 3
- Joined: 2016-04-15T13:12:17-07:00
- Authentication code: 1151
Re: Grayscale too dark
I've uploaded a tar.gz file with all the image examples to pastebin: http://pastebin.com/tgWrnbCt
Grab it (the content between the "start" and "end" lines) and do
$ openssl base64 -d <in.txt >out.tar.gz
$ tar xfvz out.tar.gz
Grab it (the content between the "start" and "end" lines) and do
$ openssl base64 -d <in.txt >out.tar.gz
$ tar xfvz out.tar.gz
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Grayscale too dark
What version of IM and what platform? Grayscale has changed over the years from non-linear to linear and back to non-linear. See viewtopic.php?f=4&t=21269. PNM (PGM) I believe is linear gray. See http://www.imagemagick.org/script/formats.php
try
try
Code: Select all
convert image.pnm -set colorspace RGB -colorspace sRGB image.png
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Grayscale too dark
With current versions of IM, what you read is what you'll get. Are your values linear RGB or non-linear sRGB? After reading, set the colourspace accordingly: "-set colorspace sRGB" or whatever. This won't change values.honkifyoulikeme wrote:All I want is the EXACT pixel values in the PNM to also be available in the PNG. ... I really, really, really, really need the EXACT values, no conversion nonsense.
snibgo's IM pages: im.snibgo.com