This project has moved and is read-only. For the latest updates, please go here.

DPX Image Format to TIFF not work?

Jan 3, 2014 at 8:38 PM
when i convert a DPX Image to a TIF image, a file will created but is corrupt.... other source files working....
Using image As New MagickImage("test.dpx")
            image.Write("test.tif")
        End Using
Jan 3, 2014 at 9:03 PM
Can you add a link to your test.dpx image? Feel free to contact me through CodePlex if you don't want to post a link here.
Jan 3, 2014 at 9:09 PM
Edited Jan 3, 2014 at 9:11 PM
no problem

http://titan.uplink.de/rept1000.dpx


btw: reading resolution and other image properties works
Jan 3, 2014 at 9:23 PM
The problem seems to be the bit depth. The resulting tif image has a bit depth of 10. When I change this to 12 I can open the image in Windows Photo Viewer. I will have to check if this is a bug in ImageMagick or lack of support for 10-bit tif files in Windows.
Jan 3, 2014 at 9:33 PM
ohh i see, when i add the 12bit convert option the the tif file is ok....
but with the 12bit convert something other happend :)

beside the 12bit convert i make a colorspace change to DCI XYZ space with this matrix
Dim matrix As New ColorMatrix(4)
        matrix(0, 0) = 0.4124564
        matrix(1, 0) = 0.3575761
        matrix(2, 0) = 0.1804375
        matrix(0, 1) = 0.2126729
        matrix(1, 1) = 0.7151522
        matrix(2, 1) = 0.072175
        matrix(0, 2) = 0.0193339
        matrix(1, 2) = 0.119192
        matrix(2, 2) = 0.9503041

Using image As New MagickImage("test.dpx")
            image.AddProfile(ColorProfile.SRGB)
            image.Gamma(0.454545)
            image.ColorMatrix(matrix)
            image.Gamma(2.6)
            image.BitDepth(Channels.Composite, 12)
            image.Write("c:\test.tif")
        End Using
without converting to 12bit (with a other source file bmp/tif 8bit) the colors are correct for the XYZ space
but with the 12bit converting i have false colors....
Jan 3, 2014 at 9:48 PM
I have no experience with the DCI XYZ color space. Does the 'normal' color space conversion not work for you:
using(image = new MagickImage("test.dpx"))
{
  image.ColorSpace=ColorSpace.XYZ;
  image.BitDepth(Channels.Composite, 12);
  image.Write("c:\test.tif");
}
Jan 3, 2014 at 9:57 PM
I have tried the build-in XYZ colorspace but this is not the right colorspace i need

before i used the magick.net, i have done the work with the Imagemagick OLE objekt and this code
img.Convert("-depth", "12", "-gamma", "0.454545", "-recolor", "0.4124564 0.3575761 0.1804375 0.2126729 0.7151522 0.0721750 0.0193339 0.1191920 0.9503041", "-gamma", "2.6", "-type", "TrueColor", input, output)
and works correct
Jan 3, 2014 at 11:06 PM
Edited Jan 3, 2014 at 11:08 PM
I think I figured out why the result from the command line is different then from Magick.NET. Magick.NET uses HDRI (http://www.imagemagick.org/script/high-dynamic-range.php) and it looks like there might be a bug in setting the channel depth in ImageMagick when HDRI is enabled. I will let get back to you when I know a bit more. Setting the bit depth to 16 bits did solve the problem for me.

p.s. The order of your matrix should be 3 instead of 4.
Jan 3, 2014 at 11:28 PM
right with 16bit it works correct, but the image is bigger and i think this takes longer.
Can the HDRI mode disabled?
Jan 3, 2014 at 11:48 PM
Edited Jan 4, 2014 at 12:00 AM
HDRI cannot be disabled because it is a compiler option. I switched to HDRI because that will be enabled by default in ImageMagick 7.

As a work around you could choose to save your image as a png first and then convert this to a 12 bit tif. This seems to work (and save disk space) but is much slower.
Jan 4, 2014 at 12:06 AM
Edited Jan 4, 2014 at 12:09 AM
My software is a Digital Cinema Mastering program, so for a movie it processes up to 300k images,
to save the images first as png it would take too much time for this amount of images :)

Exist a older version of magick.net without HDRI?
Jan 4, 2014 at 12:19 AM
With that amount of images I would also say no to the work around. Magick.NET 6.8.6.801 does not have HDRI enabled but I would really advise you to switch back to the newest version once this bug has been fixed. There have been a lot of bug fixes / improvements since that version.
Jan 4, 2014 at 12:39 AM
ok i will switch to the new version if the bug is fixed....
Jan 4, 2014 at 11:19 PM
The problem has been found and will be fixed in the next release. I have a better work around for your situation now. Call the Clamp method before you set the BitDepth
Jan 13, 2014 at 7:22 PM
hi,
is the bug in the last "6.8.8.201" version already fixed ?

PS: did you get the book from amazon? :)
Jan 13, 2014 at 7:30 PM
This bug has been fixed. And thank you for the book, I had no idea who send it to me :)
Jan 13, 2014 at 7:35 PM
ok, i will test it :)

i thought that amazon write the sender somewhere, this was my first gift that i have sent from amazon :)
Jan 13, 2014 at 7:59 PM
It does but not your nickname on CodePlex :). I send you a message through CodePlex, can you reply to that email?
Jan 13, 2014 at 8:00 PM
mhh,

i have test it, but i got the same result (false colors)
Dim matrix As New ColorMatrix(3)
        matrix(0, 0) = 0.4124564
        matrix(1, 0) = 0.3575761
        matrix(2, 0) = 0.1804375
        matrix(0, 1) = 0.2126729
        matrix(1, 1) = 0.7151522
        matrix(2, 1) = 0.072175
        matrix(0, 2) = 0.0193339
        matrix(1, 2) = 0.119192
        matrix(2, 2) = 0.9503041

        Using image As New MagickImage(input)
            image.AddProfile(ColorProfile.SRGB)
            image.BitDepth(Channels.Composite, 12)
       
                image.Gamma(0.454544)
                image.ColorMatrix(matrix)
                image.Gamma(2.6)
          
            image.Write(output)
        End Using
Jan 13, 2014 at 8:02 PM
i have send you an email back....
Jan 13, 2014 at 8:39 PM
Edited Jan 13, 2014 at 8:42 PM
You should set the BitDepth as the last operation before you write your image because this will clamp your pixels to 12 bit. You should do it like this:
Using image As New MagickImage(input)
  image.AddProfile(ColorProfile.SRGB) 'Are you sure you need this?
       
  image.Gamma(0.454544)
  image.ColorMatrix(matrix) ' This will create "out of range" pixels.
  image.Gamma(2.6)
  
  image.BitDepth(12) 'I added a new overload that accepts an integer.
  image.Write(output)
End Using
p.s. I am only writing this in VB because you got me the book :) Otherwise I would translate it to C#
Jan 13, 2014 at 8:47 PM
ok thanks, this way it works :)