Page 1 of 1

Quality loss when writing DPX files?

Posted: 2009-06-15T06:39:33-07:00
by Nicola
Hi,

is it possible to get a quality loss when writing an image as DPX compared to writing it as BMP?

If I write exactly the same data as DPX and as BMP and open it with IMDisplay I see a quality difference with disadvantage at DPX. Where could this come from?
Here you can find both variants (DPX/BMP) of the image: http://www.yourfilehost.com/media.php?c ... vs_BMP.zip

Thanks in advance,
Nicola

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T08:24:04-07:00
by magick
You need to quantify quality differences. Use the compare program with the RSME metric to compare your original image with its reconstruction. Do the metrics differ between DPX and BMP?

If you have further problems, post a URL to your original image so we can reproduce the problem.

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T08:54:41-07:00
by Nicola
The result of comparing the DPX and the BMP image is with RMSE: 6.2025 (0.243235)
So I think there is a difference. For a link to the images see my last post - or do you need direct links to the images?

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T09:21:57-07:00
by magick
Ok, we type
  • -> convert test_IM.dpx test.bmp
    -> compare -metric rmse test_IM.dpx test.bmp null:
    0 (0)
Which shows the pixels are exactly the same when converting DPX to BMP. Now lets try the reverse:
  • -> convert test.bmp test.dpx
    -> compare -metric rmse test_IM.dpx test.dpx null:
    0 (0)
Once again there is no loss of pixel information. We're using ImageMagick 6.5.3-7, the latest release.

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T09:35:33-07:00
by Nicola
Let me explain what I did:
1. Writing an image given as unsigned char array to DPX and BMP (in VC++):

Code: Select all

Magick::Image cMagickImage(
            pcBmpBuffer->getWidth(),
            pcBmpBuffer->getHeight(),
            "BGR",
            Magick::CharPixel,
            pcBmpBuffer->getImage() );

// set the image type
cMagickImage.type( Magick::TrueColorType );

// flip the image since the original is ordered bottom-to-top
cMagickImage.flip();
cMagickImage.orientation( Magick::BottomLeftOrientation );

// write the image
cMagickImage.write( "test.dpx" );
cMagickImage.write( "test.bmp" );
2. Copmaring the two resulting images:

Code: Select all

compare -metric RMSE test.bmp test.dpx diff.bmp

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T09:44:05-07:00
by fmw42
Since you are flipping the image, have you actually viewed the results and visually compared them to see that both have the same orientation?

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T09:47:29-07:00
by Nicola
Hm...some curiosity: "compare" of the same DPX image results in: 3.5474 (0.0139114) :shock:

EDIT: I'm using ImageMagick-6.5.3-Q8

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T09:53:04-07:00
by Nicola
fmw42 wrote:Since you are flipping the image, have you actually viewed the results and visually compared them to see that both have the same orientation?
I think the images should be the same since I write exactly the same image once as DPX and directly after this once as BMP! Comparing them visually they are the same except the mentioned quality difference.

Re: Quality loss when writing DPX files?

Posted: 2009-06-15T10:09:24-07:00
by fmw42
Hm...some curiosity: "compare" of the same DPX image results in: 3.5474 (0.0139114)

EDIT: I'm using ImageMagick-6.5.3-Q8
On Q8, you are seeing only 1.4% difference. I don't know much about DPX images (or bmp) to know if they have any natural loss of quality similar to JPEG due to compression. You should check to see if there is any built-in compression for either and disable or set similar.

see
http://www.imagemagick.org/Usage/formats/#bmp
http://www.imagemagick.org/Usage/formats/#dpx

an IM Q16 install may be more accurate?

Re: Quality loss when writing DPX files?

Posted: 2009-06-16T08:05:56-07:00
by Nicola
fmw42 wrote:an IM Q16 install may be more accurate?
Could this really be an option? I'd not like to change to Q16 with no opportunity of solution by this...

Re: Quality loss when writing DPX files?

Posted: 2009-06-16T10:09:21-07:00
by fmw42
On my IM 6.5.3-7 Q16 Mac OSX Tiger:

compare -metric rmse test_IM.dpx test_IM.dpx null:
0 (0)

compare -metric rmse test_IM.dpx test_IM.bmp null:
0 (0)


Perhaps you are using too old a version of IM or it has a bug. Have you tried upgrading? Otherwise, perhaps it is Q8 vs Q16.

Re: Quality loss when writing DPX files?

Posted: 2009-06-17T01:44:26-07:00
by Nicola
I changed the bit depth of the DPX file to 10 (still using Q8) so I can import it into AfterEffects. In AE it looks exactly the same as the BMP, although it doesn't in IMDisplay (still the mentioned quality difference). With it, my problems are solved for the moment but I think the IMDisplay needs to be reworked.

Best regards and many thanks for your help,
Nicola