Page 1 of 1
my dpx file are darker once converted
Posted: 2013-01-22T02:02:55-07:00
by miqui0287
Hi all!
I have been using the Api ImageMagick++ on Visual Studio 2010 and it works perfectly.
But I'm in trouble with DPX files. Indeed, I load DPX images thank the read method of the Image Class and save them thank the write method like following :
Code: Select all
#include <Magick++.h>
#include <string>
#include <iostream>
using namespace std;
using namespace Magick;
int main( int /*argc*/, char ** argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
Image my_image;
my_image.read("a.dpx");
my_image.write("./out/b.tiff");
my_image.write("./out/c.dpx");
my_image.write("./out/d.bmp");
my_image.write("./out/e.jpg");
return 0;
}
The files are well saved, good height, good width, goop depth, ... but when I look them in IMDisplay, for example, only the "c.dpx" image looks like "a.dpx". The others are similary but really darker.
Where does come from this darkness and is there a solution to my problem ?
Thx for your replies.
M.
Re: my dpx file are darker once converted
Posted: 2013-01-22T10:44:30-07:00
by snibgo
Do you get the same dark results from the command line:
If so, it may be a RGB/sRGB issue. What version IM are you running? Can you post a.dpx somewhere?
Re: my dpx file are darker once converted
Posted: 2013-01-23T01:11:09-07:00
by miqui0287
Hi Snibgo !
Thx for you reply.
Try to use convert.exe was a good idea but unfortunatly it did the same...
I'm working with the ImageMagick-6.8.1-Q16_vs2010 version and my aim is to use Magick++ Classes in my own code.
I'm going to try to change color space (sRGB->RGB), before save my new image in tiff.
I could post my dpx image somewhere, it's a 4K 16bits file, so you guess it's a heavy file (50 Mo, 30 when I zip it).
May be, I could send it to you by personal message or you could give a space where I would post it.
Thx.
M.
Re: my dpx file are darker once converted
Posted: 2013-01-23T01:40:29-07:00
by snibgo
dropbox.com is a common place for this. A zip is best, or the server might try to convert it to a jpeg or something, possibly using ImageMagick, and that confuses every one.
Re: my dpx file are darker once converted
Posted: 2013-01-23T02:22:47-07:00
by miqui0287
Here is my dpx file :
http://dl.dropbox.com/u/27496908/a.zip
Thank for your help !
Re: my dpx file are darker once converted
Posted: 2013-01-23T03:15:28-07:00
by miqui0287
I'm now trying to change the colorspace of my Image, but I fail...
I tried this :
Code: Select all
Image my_image;
my_image.read("a.dpx");
my_image.colorSpace(Magick::RGBColorspace);
my_image.write("./out/c.dpx");
my_image.write("./out/b.tiff");
c.dpx is exactly the same as a.dpx, but b.tiff is completly black.
I tried also :
Code: Select all
Image my_image;
my_image.read("a.dpx");
my_image.type(TrueColorType);
my_image.write("./out/c.dpx");
my_image.write("./out/b.tiff");
And I get exactly the same problem...
I hope, you'll be luckier!
M.
Re: my dpx file are darker once converted
Posted: 2013-01-23T04:03:49-07:00
by snibgo
Yeah, it's dark, isn't it?!
But not entirely black. "identify -verbose" says the pixels have a mean of about 0.02 (on a scale of 0 to 1). Doing a simple conversion to tiff gives the same mean pixel values, although "identify" says the dpx is RGB and the tiff is sRGB.
We can force a conversion, after declaring the dpx to be in RGB:
Code: Select all
convert a.dpx -set colorspace RGB colorspace sRGB a1.tiff
Now "identify" says the mean values are about 0.15, and I can see leaves against a dark background, with a hazy light bottom-centre.
(Instead of "-set colorspace RGB colorspace sRGB", I could use "-gamma 2.2" to give almost the same result.)
I can easily get a more visible image ...
Code: Select all
convert a1.tiff -auto-level -auto-gamma a2.tiff
... so if you just want to view the image, this works fine.
I have no viewers for dpx files, and don't know what the image should look like. Does "-set colorspace RGB colorspace sRGB" give you the result you expect?
(I've converted to tiff because that's what I generally use, but converting to jpg gives the same results.)
Re: my dpx file are darker once converted
Posted: 2013-01-23T06:12:21-07:00
by miqui0287
Hum...it seems that "convert a.dpx -set colorspace RGB colorspace sRGB a1.tiff" doesn't run on my computer, but "convert a.dpx -colorspace RGB a1.tiff" does.
The result of this command line is the same as former result...but when I try this "convert a.dpx -colorspace sRGB a1.tiff", I get what I was expecting !!!
You were right, it was colorspace problem...
I added just one 's' to my code :
Code: Select all
Image my_image;
my_image.read("a.dpx");
my_image.colorSpace(Magick::sRGBColorspace);
my_image.write("./out/b.tiff");
And I get my result!
Thank you for your help!
BTW, if you want to watch DPX file, use IMDisplay. Its exe file is the same directory of convert.exe, identify.exe,...
Bye
M.
Re: my dpx file are darker once converted
Posted: 2013-01-23T06:25:03-07:00
by snibgo
Bother, sorry, it needs another "-" before "colorspace:
Code: Select all
convert a.dpx -set colorspace RGB -colorspace sRGB a1.tiff
Sadly, imdisplay doesn't work under Windows, which is what I have in front of me. Besides, using IM software to verify other IM software would be dodgy.
But you've got it working, so that's good.
Re: my dpx file are darker once converted
Posted: 2013-01-23T06:38:57-07:00
by miqui0287
I'm working on Window seven and IMDisplay works perfectly.
Moreover, it seems it had been developped with MFC so it should work on window.
It's a shame, you can't use it, because it's a powerful tool.
See you.
M.
Re: my dpx file are darker once converted
Posted: 2013-01-23T07:10:16-07:00
by snibgo
Ah, yes ... imdisplay won't start for me from the command line, but does from start, all programs, etc. The recent-files list shows that I have used it before. I need to remember that I have it.