convert DPX 10 bit Log to Lin

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
fournij

convert DPX 10 bit Log to Lin

Post by fournij » 2008-12-04T12:19:37-07:00

Hi

I want to convert DPX files 10 bit Log to Lin (Log to Lin).

Theses files are produced by an ARRISCAN (film scanner) and I want to make a Linear version to put on the web.

The black and white points are set at 95 and 685.

You can download a sample DPX file here :

ftp://ftp.nfb.ca/pub/0000047.dpx

Here is the verbose output of the file :

Code: Select all

C:\Program Files\ImageMagick-6.4.6-Q16>identify -verbose D:\0000047.dpx
Image: D:\0000047.dpx
  Format: DPX (SMPTE 268M-2003 (DPX 2.0))
  Class: DirectClass
  Geometry: 2280x1596+0+0
  Resolution: 72x72
  Print size: 31.6667x22.1667
  Units: Undefined
  Type: TrueColor
  Base type: TrueColor
  Endianess: MSB
  Colorspace: RGB
  Depth: 10-bit
  Channel depth:
    red: 10-bit
    green: 10-bit
    blue: 10-bit
  Channel statistics:
    red:
      min: 101 (0.0986343)
      max: 1017 (0.993179)
      mean: 368.185 (0.359561)
      standard deviation: 267.888 (0.261613)
    green:
      min: 101 (0.0986343)
      max: 1017 (0.993179)
      mean: 357.395 (0.349024)
      standard deviation: 256.658 (0.250647)
    blue:
      min: 101 (0.0986343)
      max: 1017 (0.993179)
      mean: 359.838 (0.35141)
      standard deviation: 252.007 (0.246104)
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 2280x1596+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: TopLeft
  Properties:
    comment: NFB_testcans
    create-date: 2008-12-04T10:09:23-05:00
    document: 0000047.dpx
    dpx:file.creator: ARRISCAN078
    dpx:file.ditto.key: 1
    dpx:file.filename: 0000047.dpx
    dpx:file.project: NFB_testcans
    dpx:file.timestamp: 2008:11:17:12:12:34+10
    dpx:file.version: V1.0
    dpx:film.count: 0000
    dpx:film.frame_position: 47
    dpx:film.held_count: 0
    dpx:film.offset: 00
    dpx:film.prefix: 000000
    dpx:film.sequence_extent: 5001
    dpx:film.type: 00
    dpx:image.orientation: 0
    dpx:orientation.aspect_ratio: 1x1
    dpx:orientation.border: 0x0+0+0
    dpx:orientation.device: Cuckoo_MrEdgar
    dpx:orientation.x_offset: 0
    dpx:orientation.x_size: 2280
    dpx:orientation.y_offset: 0
    dpx:orientation.y_size: 1596
    dpx:television.time.code: 00:00:01:23
    dpx:television.user.bits: 00:00:00:00
    modify-date: 2008-11-17T07:12:34-05:00
    signature: cba4f20e6457b215e6eb9836621ff3961bcf7392adda77ba7359d1e73a26e14b
    software: ARRISCAN078
  Profiles:
    Profile-dpx:user.data: 6112 bytes
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 13.89mb
  Number pixels: 3.47mb
  Pixels per second: 44.49mb
  User time: 0.078u
  Elapsed time: 0:01
  Version: ImageMagick 6.4.6 2008-11-25 Q16 http://www.imagemagick.org
Also I extracted the Transfer Characteristics of the file (in the header of the DPX file) :

3 - Logarithmic


I have also a Lookup table LUT here :

ftp://ftp.nfb.ca/pub/10BitLogToLin_gamm ... tclip0.lut


I want to use Magick++ to do the conversion but I don't know how to apply the LUT or something else.


Is somebody can help me ?

Thanks

User avatar
magick
Site Admin
Posts: 11065
Joined: 2003-05-31T11:32:55-07:00

Re: convert DPX 10 bit Log to Lin

Post by magick » 2008-12-04T12:34:30-07:00

You should not need the LUT. ImageMagick has a built-in Log to Linear conversion when you set the RGB colorspace. Use image.colorspace(RGBColorspace) after you read the DPX image. To adjust the Log => Linear conversion you can set the reference-black and reference-white attributes. The default to 95 and 685 which agrees with your LUT. Set the gamma attribute to change the reference gamma. It defaults to 1.0/1.7.

fournij

Re: convert DPX 10 bit Log to Lin

Post by fournij » 2008-12-04T12:53:44-07:00

Hi

thanks for the quick answer, but as you can see the colorspace of my DPX file is already RGB :

Code: Select all

C:\Program Files\ImageMagick-6.4.6-Q16>identify -verbose D:\0000047.dpx
Image: D:\0000047.dpx
  Format: DPX (SMPTE 268M-2003 (DPX 2.0))
...
  Colorspace: RGB
...
The only parameter on my DPX file about logarithmic is the "transfert characteristic" : 3 - Logarithmic

This file came from an ARRISCANNER and I'm sure they do it as the SMPTE standard.


So I tried anyway this command line :

Code: Select all

C:\Program Files\ImageMagick-6.4.6-Q16>convert.exe -colorspace rgb D:\0000047.dpx -set gamma 1.0 -set reference-black 95 -set reference-white 685 D:\result.dpx
As you can see : ftp://ftp.nfb.ca/pub/result.dpx
The result file looks like the log source file.

Is ImageMagick handle the Transfert Characteristic parameters in the header file ?

Do I make mistake ?

Are you able to download my samples files ?

Thanks

User avatar
magick
Site Admin
Posts: 11065
Joined: 2003-05-31T11:32:55-07:00

Re: convert DPX 10 bit Log to Lin

Post by magick » 2008-12-04T13:18:55-07:00

Put the colorspace attribute after the input image:
  • convert.exe D:\0000047.dpx -set gamma 1.0 -set reference-black 95 -set reference-white 685 -colorspace RGB D:\result.dpx

fournij

Re: convert DPX 10 bit Log to Lin

Post by fournij » 2008-12-04T14:31:36-07:00

Hi

same result... :

ftp://ftp.nfb.ca/pub/result_colorspace_after.dpx


Also I did another test with the gamma at 1.7 and I don't see any difference...

Thanks

User avatar
magick
Site Admin
Posts: 11065
Joined: 2003-05-31T11:32:55-07:00

Re: convert DPX 10 bit Log to Lin

Post by magick » 2008-12-04T18:12:36-07:00

Ok, we inspected your image more carefully. According to the image element descriptor the pixels are in the RGB colorspace. The component type returned is 50. The image is interpreted in the Log colorspace if the image element descriptor is RGB or YCbCR (Rec601 or Rec709) and the image element transfer is PrintingDensityColorimetric (1). If our interpretation of the DPX specification is incorrect, let us know. Another possibility is an option to force the colorspace to Log and then transform it with the -colorspace RGB option. That might already be possible with -set colorspace Log, not sure since we have not tried it.

fournij

Re: convert DPX 10 bit Log to Lin

Post by fournij » 2008-12-05T07:48:00-07:00

Hi

Using the software "DPX Viewer" I can read the header of my DPX file, the image element descriptor is 50 (RGB) but the image element transfert is Logarithmic(3) not PrintingDensityColorimetric(1). Maybe is the reason why ImageMagick doesn't interpret this DPX file as a Log colorspace is because the image element transfert isn't set as PrintingDensitycolorimetric(1) but at Logarithmic(3) ?? As you said :
The image is interpreted in the Log colorspace if the image element descriptor is RGB or YCbCR (Rec601 or Rec709) and the image element transfer is PrintingDensityColorimetric (1).

Just to give a try, I tried this command line :

Code: Select all

Convert D:\0000047.dpx -colorspace log D:\ResultLog.dpx
The image element descriptor of the result file is RGB(50) and the image element transfert is now PrintingDensityColorimetric(1), but the white point and black point have changed again (highlinghts becoming darker).

Is it possible to handle the parameters of my DPX file (image element descriptor : RGB(50) and image element transfert : Logarithmic(3)) as a Log file, so I will be able to use the following command line to convert it directly in Linear.

Code: Select all

convert.exe D:\0000047.dpx -set gamma 1.7 -set reference-black 95 -set reference-white 685 -colorspace RGB D:\result.dpx

User avatar
magick
Site Admin
Posts: 11065
Joined: 2003-05-31T11:32:55-07:00

Re: convert DPX 10 bit Log to Lin

Post by magick » 2008-12-05T08:07:31-07:00

We have a patch in ImageMagick 6.4.7-1 Beta to fix the problem you reported. 6.4.7-1 will be available by tomorrow here: ftp://ftp.imagemagick.org/pub/ImageMagick/beta.

fournij

Re: convert DPX 10 bit Log to Lin

Post by fournij » 2008-12-05T08:44:25-07:00

Thanks !!!

In the mean time I did another test : I use DVS Spycer to modifiy the header of my DPX file, so I changed the image element transfert to printdensity(1) and I tried the command line and it's work !!! So if in the next version you handle the image element transfert logarithmic(3), it will be perfect, because I don't want to modify the header of my DPX files before using ImageMagick...

So I will wait for ImageMagick-6.4.7-1-Q16-windows-dll.exe

Thanks a lot for all your support

fournij

Re: convert DPX 10 bit Log to Lin

Post by fournij » 2008-12-05T14:14:31-07:00

Hi

is it possible to extract the attibute "image element transfert" with the magick++ fonction attribute or with the command :

identify -format "%[dpx:xxxxx.xxxx.xxxx.xxxxx....]" input.dpx



thanks

User avatar
magick
Site Admin
Posts: 11065
Joined: 2003-05-31T11:32:55-07:00

Re: convert DPX 10 bit Log to Lin

Post by magick » 2008-12-05T19:03:04-07:00

The image transfer information is not available as an image property at this time.

Jimbo
Posts: 23
Joined: 2019-08-26T12:24:48-07:00
Authentication code: 1152

Re: convert DPX 10 bit Log to Lin

Post by Jimbo » 2019-09-07T11:38:00-07:00

I'm a little confused about the DPX specs that this thread has mentioned.
DPX has both a Log and Linear specification, and can be created or read as either.
A Log to Lin conversion would be necessary, if the original file is in Log space and the user would like to
use the linear space available at most workstations to do their work.

If the original DPX is linear, no log to line is necessary.

Did I miss something in the discussion? It seemed to imply that DPX was only ever log.
That was true originally, but the linear spec has been there for some time now. I first
became aware of it from the author of the format in 2010.

- Jimbo

Post Reply