I'm trying to convert a PNG to DPX without applying a log function. I can ALMOST get the right results using
convert -colorspace sRGB colorramp.png colorramp.dpx
which says the source is already in log space, but not quite, because the sRGB curve isn't a perfect log curve. So how do I convert without molesting the colors at all?
PNG to DPX without log
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG to DPX without log
I do not know much about DPX images, but DPX is by nature logarithmic. I do not know if you can create a linear DPX.
Don't know if this helps, but
see http://www.imagemagick.org/script/formats.php
DPX RW SMPTE Digital Moving Picture Exchange 2.0 (SMPTE 268M-2003) Use -set to specify the image gamma or black and white points (e.g. -set gamma 1.7, -set reference-black 95, -set reference-white 685).
and
http://www.imagemagick.org/script/motion-picture.php
Don't know if this helps, but
see http://www.imagemagick.org/script/formats.php
DPX RW SMPTE Digital Moving Picture Exchange 2.0 (SMPTE 268M-2003) Use -set to specify the image gamma or black and white points (e.g. -set gamma 1.7, -set reference-black 95, -set reference-white 685).
and
http://www.imagemagick.org/script/motion-picture.php
Re: PNG to DPX without log
I'm not trying to create a linear DPX, I'm just trying to preserve the colors in the original PNG. Without any arguments, it seems to assume the PNG colors are in linear RGB space and thus applies a log function to them. I'm trying to prevent this from happening.
Re: PNG to DPX without log
Which version of ImageMagick? The current release, 6.8.9-1, saves in the source colorspace. PNG images are sRGB, convert this to DPX, and a sRGB DPX image is written.
Re: PNG to DPX without log
I'm on 6.5.4-7 2012-04-10 Q16 OpenMP - so maybe I should upgrade. Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG to DPX without log
The sRGB and RGB were swapped at that time. So then sRGB was linear color and RGB was non-linear color, ie. backwards. See viewtopic.php?f=4&t=21269MGrossman wrote:I'm on 6.5.4-7 2012-04-10 Q16 OpenMP - so maybe I should upgrade. Thanks
You would be well of upgrading if you can since your version is nearly 350 versions old.
Re: PNG to DPX without log
OK, here in more detail are my (still bad) results using convert release, 6.8.9-1
My .png is definitely in sRGB space according to identify. It contains a color ramp from 0-255; pixel (128,1) has value 128. The first 5 pixel color values are 0, 1, 2, 3, 4.
convert foo.png foo.dpx causes an sRGB function (i.e. an exponent of about 1/2.2) to be applied to all my colors. Pixel (128,1) has value 185. The first 5 pixel color values are 0, 12, 21, 28, 33 (so the function isn't a pure exponent but it isn't the standard sRGB function either). convert -colorspace sRGB does the same thing.
convert -colorspace RGB foo.png foo.dpx better preserves the input color space but not until apparently two color space conversions back to back in an 8-bit quantized manner. Instead of the original png colors starting 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12... the dpx has (approximately) 0, 0, 0, 0, 0... 12, 12, 12, 12... 21, 21, 21... 28, 28, 28...
So I still really just want to convert from png to dpx without changing the color values at all.
thanks
My .png is definitely in sRGB space according to identify. It contains a color ramp from 0-255; pixel (128,1) has value 128. The first 5 pixel color values are 0, 1, 2, 3, 4.
convert foo.png foo.dpx causes an sRGB function (i.e. an exponent of about 1/2.2) to be applied to all my colors. Pixel (128,1) has value 185. The first 5 pixel color values are 0, 12, 21, 28, 33 (so the function isn't a pure exponent but it isn't the standard sRGB function either). convert -colorspace sRGB does the same thing.
convert -colorspace RGB foo.png foo.dpx better preserves the input color space but not until apparently two color space conversions back to back in an 8-bit quantized manner. Instead of the original png colors starting 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12... the dpx has (approximately) 0, 0, 0, 0, 0... 12, 12, 12, 12... 21, 21, 21... 28, 28, 28...
So I still really just want to convert from png to dpx without changing the color values at all.
thanks
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: PNG to DPX without log
Perhaps your input isn't really sRGB. What is the gamma?
These commands give the same outputs for the png and dpx (IM v6.8.9-0 on Windows 8.1):
These commands give the same outputs for the png and dpx (IM v6.8.9-0 on Windows 8.1):
Code: Select all
%IM%convert -size 1x10 gradient: g.png
%IM%convert g.png g.dpx
%IM%convert g.png txt:
%IM%convert g.dpx txt:
snibgo's IM pages: im.snibgo.com
Re: PNG to DPX without log
Hey, that txt: option is nice. It shows that the color values really are the same inside the file. So now I'm thinking I've been thrown off by IMDisplay 6.8.8-1 all this time. It must be doing an extra gamma conversion on the dpx that it doesn't do on the png. Running on a Win 8.1 desktop.