reference white and reference black in dpx

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
jgbas67

reference white and reference black in dpx

Post by jgbas67 »

Hello, I have a problem with this dpx settings. I´m using ImageMagick 6.5.1 Q16, and developing using C wand.
My problem is that I need to set dpx:television.gamma, dpx:television.white_level and dpx:television.black_level. The first one works allright, but not the others. I have tried using diferent values, but always without succes. I heard that the value should be floating point, but I´m still without succes.

This is a short version of my program (just from the IM examples):

Code: Select all

#include <stdio.h>
#include <wand/magickwand.h>

int main(int argc,char **argv)
{
#define ThrowWandException(wand) \
{ \
  char \
    *description; \
 \
  ExceptionType \
    severity; \
 \
  description=MagickGetException(wand,&severity); \
  (void) fprintf(stderr,"%s %s %lu %s\n",GetMagickModule(),description); \
  description=(char *) MagickRelinquishMemory(description); \
  exit(-1); \
}
  if (argc != 3){
      (void) fprintf(stdout,"Usage: %s image thumbnail ICCprofile\n",argv[0]);
      system("PAUSE");
      exit(0);
  }
  
  MagickBooleanType status;
  MagickWand *magick_wand;

  /*  Read an image. */
  MagickWandGenesis();
  magick_wand=NewMagickWand();
  status=MagickReadImage(magick_wand, argv[1]);
  if (status == MagickFalse)
    ThrowWandException(magick_wand);

  /* Turn the images into a thumbnail sequence. */
  MagickResetIterator(magick_wand);
  while (MagickNextImage(magick_wand) != MagickFalse){
    MagickSetOption(magick_wand, "dpx:television.gamma","1.9");  // funciona
    MagickSetOption(magick_wand, "dpx:television.white_level","95,0"); //no lo guarda
    MagickSetOption(magick_wand, "dpx:television.black_level","685.0"); //no lo guarda
  }
    
  /*  Write the image then destroy it. */
  status=MagickWriteImages(magick_wand,argv[2],MagickTrue);
  if (status == MagickFalse)
    ThrowWandException(magick_wand);

  magick_wand=DestroyMagickWand(magick_wand);
  MagickWandTerminus();
  system("PAUSE");
  return(0);
}
And my results are:

Code: Select all

>identify -format "%[dpx:*]" img1.dpx
dpx:file.creator=ImageMagick 6.5.1-6 2009-04-22 Q16 OpenMP http://www.imagemagick.org
dpx:file.ditto.key=1
dpx:file.timestamp=2009-05-11T12:37:09+02:
dpx:file.version=V2.0
dpx:film.frame_position=0
dpx:film.held_count=0
dpx:film.sequence_extent=0
dpx:image.orientation=0
dpx:orientation.aspect_ratio=0x0
dpx:orientation.border=0x0+0+0
dpx:orientation.x_offset=0
dpx:orientation.x_size=0
dpx:orientation.y_offset=0
dpx:orientation.y_size=0
dpx:television.gamma=1.9
dpx:television.time.code=00:00:00:00
dpx:television.user.bits=00:00:00:00
where I can´t see these two settings.

Thanks for anyone who could help me!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: reference white and reference black in dpx

Post by magick »

The white value is set its just now being reported. We have a patch in ImageMagick-6.5.2-5 Beta to fix the problem. If you don't want to wait, replace this inline method in coders/dpx.c:

Code: Select all

static inline MagickBooleanType IsFloatDefined(const float value)
{
  union
  {
    unsigned int
      unsigned_value;

    float
      float_value;
  } quantum;

  quantum.unsigned_value=0U;
  quantum.float_value=value;
  if (quantum.unsigned_value == 0U)
    return(MagickFalse);
  return(MagickTrue);
}
Post Reply