]> granicus.if.org Git - imagemagick/blobdiff - coders/dpx.c
(no commit message)
[imagemagick] / coders / dpx.c
index 971ed93c77bbc23564c6cb4104b205fa33434e34..3b3b2ef2a3bc2e2047cfea2f17cab9be5d975bd5 100644 (file)
 /*
   Include declarations.
 */
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/colorspace.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/geometry.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/module.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/option.h"
-#include "magick/profile.h"
-#include "magick/property.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/string-private.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/attribute.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/colorspace.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/geometry.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/option.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/profile.h"
+#include "MagickCore/property.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/string-private.h"
 \f
 /*
   Typedef declaration.
@@ -305,7 +307,7 @@ typedef struct DPXInfo
   Forward declaractions.
 */
 static MagickBooleanType
-  WriteDPXImage(const ImageInfo *,Image *);
+  WriteDPXImage(const ImageInfo *,Image *,ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -443,7 +445,7 @@ static inline MagickBooleanType IsFloatDefined(const float value)
     unsigned int
       unsigned_value;
 
-    float
+    double
       float_value;
   } quantum;
 
@@ -527,7 +529,7 @@ static void TimeCodeToString(const size_t timestamp,char *code)
   shift=4*TimeFields;
   for (i=0; i <= TimeFields; i++)
   {
-    (void) FormatMagickString(code,MaxTextExtent-strlen(code),"%x",
+    (void) FormatLocaleString(code,MaxTextExtent-strlen(code),"%x",
       (unsigned int) ((timestamp >> shift) & 0x0fU));
     code++;
     if (((i % 2) != 0) && (i < TimeFields))
@@ -549,10 +551,6 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
   Image
     *image;
 
-  ssize_t
-    row,
-    y;
-
   MagickBooleanType
     status;
 
@@ -568,18 +566,18 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
   register ssize_t
     i;
 
-  ssize_t
-    count;
-
   size_t
-    extent;
+    extent,
+    samples_per_pixel;
+
+  ssize_t
+    count,
+    row,
+    y;
 
   unsigned char
     component_type;
 
-  size_t
-    samples_per_pixel;
-
   /*
     Open image file.
   */
@@ -590,7 +588,7 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
       image_info->filename);
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
-  image=AcquireImage(image_info);
+  image=AcquireImage(image_info,exception);
   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
   if (status == MagickFalse)
     {
@@ -681,14 +679,14 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
   switch (dpx.image.orientation)
   {
     default:
-    case 0:  image->orientation=TopLeftOrientation; break;
-    case 1:  image->orientation=TopRightOrientation; break;
-    case 2:  image->orientation=BottomLeftOrientation; break;
-    case 3:  image->orientation=BottomRightOrientation; break;
-    case 4:  image->orientation=LeftTopOrientation; break;
-    case 5:  image->orientation=RightTopOrientation; break;
-    case 6:  image->orientation=LeftBottomOrientation; break;
-    case 7:  image->orientation=RightBottomOrientation; break;
+    case 0: image->orientation=TopLeftOrientation; break;
+    case 1: image->orientation=TopRightOrientation; break;
+    case 2: image->orientation=BottomLeftOrientation; break;
+    case 3: image->orientation=BottomRightOrientation; break;
+    case 4: image->orientation=LeftTopOrientation; break;
+    case 5: image->orientation=RightTopOrientation; break;
+    case 6: image->orientation=LeftBottomOrientation; break;
+    case 7: image->orientation=RightBottomOrientation; break;
   }
   dpx.image.number_elements=ReadBlobShort(image);
   offset+=2;
@@ -731,6 +729,7 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
     offset+=ReadBlob(image,sizeof(dpx.image.image_element[i].description),
       (unsigned char *) dpx.image.image_element[i].description);
   }
+  SetImageColorspace(image,RGBColorspace,exception);
   SetPrimaryChromaticity((DPXColorimetric)
     dpx.image.image_element[0].colorimetric,&image->chromaticity);
   offset+=ReadBlob(image,sizeof(dpx.image.reserve),(unsigned char *)
@@ -892,26 +891,26 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
       dpx.television.time_code=(unsigned int) ReadBlobLong(image);
       offset+=4;
       TimeCodeToString(dpx.television.time_code,value);
-      (void) SetImageProperty(image,"dpx:television.time.code",value);
+      (void) SetImageProperty(image,"dpx:television.time.code",value,exception);
       dpx.television.user_bits=(unsigned int) ReadBlobLong(image);
       offset+=4;
       TimeCodeToString(dpx.television.user_bits,value);
-      (void) SetImageProperty(image,"dpx:television.user.bits",value);
+      (void) SetImageProperty(image,"dpx:television.user.bits",value,exception);
       dpx.television.interlace=(unsigned char) ReadBlobByte(image);
       offset++;
       if (dpx.television.interlace != 0)
-        (void) FormatImageProperty(image,"dpx:television.interlace","%ld",(ssize_t)
-          dpx.television.interlace);
+        (void) FormatImageProperty(image,"dpx:television.interlace","%.20g",
+          (double) dpx.television.interlace);
       dpx.television.field_number=(unsigned char) ReadBlobByte(image);
       offset++;
       if (dpx.television.field_number != 0)
-        (void) FormatImageProperty(image,"dpx:television.field_number","%ld",
-          (ssize_t) dpx.television.field_number);
+        (void) FormatImageProperty(image,"dpx:television.field_number","%.20g",
+          (double) dpx.television.field_number);
       dpx.television.video_signal=(unsigned char) ReadBlobByte(image);
       offset++;
       if (dpx.television.video_signal != 0)
-        (void) FormatImageProperty(image,"dpx:television.video_signal","%ld",
-          (ssize_t) dpx.television.video_signal);
+        (void) FormatImageProperty(image,"dpx:television.video_signal","%.20g",
+          (double) dpx.television.video_signal);
       dpx.television.padding=(unsigned char) ReadBlobByte(image);
       offset++;
       if (dpx.television.padding != 0)
@@ -985,14 +984,17 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
           StringInfo
             *profile;
 
-           profile=AcquireStringInfo(dpx.file.user_size);
+           profile=BlobToStringInfo((const void *) NULL,
+             dpx.file.user_size-sizeof(dpx.user.id));
+           if (profile == (StringInfo *) NULL)
+             ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
            offset+=ReadBlob(image,GetStringInfoLength(profile),
              GetStringInfoDatum(profile));
-           (void) SetImageProfile(image,"dpx",profile);
+           (void) SetImageProfile(image,"dpx",profile,exception);
            profile=DestroyStringInfo(profile);
         }
     }
-  for ( ; offset < (ssize_t) dpx.file.image_offset; offset++)
+  for ( ; offset < (MagickOffsetType) dpx.file.image_offset; offset++)
     (void) ReadBlobByte(image);
   /*
     Read DPX image header.
@@ -1045,21 +1047,21 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
     case CbYACrYA4224ComponentType:
     case CbYCr444ComponentType:
     {
-      image->colorspace=Rec709YCbCrColorspace;
+      SetImageColorspace(image,Rec709YCbCrColorspace,exception);
       break;
     }
     case LumaComponentType:
     {
-      image->colorspace=RGBColorspace;
+      SetImageColorspace(image,sRGBColorspace,exception);
       break;
     }
     default:
     {
-      image->colorspace=RGBColorspace;
+      SetImageColorspace(image,sRGBColorspace,exception);
       if (dpx.image.image_element[0].transfer == LogarithmicColorimetric)
-        image->colorspace=LogColorspace;
+        SetImageColorspace(image,LogColorspace,exception);
       if (dpx.image.image_element[0].transfer == PrintingDensityColorimetric)
-        image->colorspace=LogColorspace;
+        SetImageColorspace(image,LogColorspace,exception);
       break;
     }
   }
@@ -1078,21 +1080,19 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
     MagickTrue : MagickFalse);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
-    ssize_t
-      offset;
-
     MagickBooleanType
       sync;
 
-    register PixelPacket
+    register Quantum
       *q;
 
-    ssize_t
-      count;
-
     size_t
       length;
 
+    ssize_t
+      count,
+      offset;
+
     unsigned char
       *pixels;
 
@@ -1108,7 +1108,7 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
             proceed;
 
           proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) row,
-                image->rows);
+            image->rows);
           if (proceed == MagickFalse)
             status=MagickFalse;
         }
@@ -1117,13 +1117,14 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if (count != (ssize_t) extent)
       status=MagickFalse;
     q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
-    if (q == (PixelPacket *) NULL)
+    if (q == (Quantum *) NULL)
       {
         status=MagickFalse;
         continue;
       }
     length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
       quantum_type,pixels,exception);
+    (void) length;
     sync=SyncAuthenticPixels(image,exception);
     if (sync == MagickFalse)
       status=MagickFalse;
@@ -1225,7 +1226,8 @@ ModuleExport void UnregisterDPXImage(void)
 %
 %  The format of the WriteDPXImage method is:
 %
-%      MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
+%      MagickBooleanType WriteDPXImage(const ImageInfo *image_info,
+%        Image *image,ExceptionInfo *exception)
 %
 %  A description of each parameter follows.
 %
@@ -1233,10 +1235,12 @@ ModuleExport void UnregisterDPXImage(void)
 %
 %    o image:  The image.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
 
 static inline const char *GetDPXProperty(const ImageInfo *image_info,
-  const Image *image,const char *property)
+  const Image *image,const char *property,ExceptionInfo *exception)
 {
   const char
     *value;
@@ -1244,7 +1248,7 @@ static inline const char *GetDPXProperty(const ImageInfo *image_info,
   value=GetImageOption(image_info,property);
   if (value != (const char *) NULL)
     return(value);
-  return(GetImageProperty(image,property));
+  return(GetImageProperty(image,property,exception));
 }
 
 static unsigned int StringToTimeCode(const char *key)
@@ -1276,7 +1280,8 @@ static unsigned int StringToTimeCode(const char *key)
   return(value);
 }
 
-static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image,
+  ExceptionInfo *exception)
 {
   const char
     *value;
@@ -1287,10 +1292,8 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
   DPXInfo
     dpx;
 
-  ssize_t
-    horizontal_factor,
-    vertical_factor,
-    y;
+  GeometryInfo
+    geometry_info;
 
   MagickBooleanType
     status;
@@ -1301,16 +1304,13 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
   MagickStatusType
     flags;
 
-  GeometryInfo
-    geometry_info;
-
   QuantumInfo
     *quantum_info;
 
   QuantumType
     quantum_type;
 
-  register const PixelPacket
+  register const Quantum
     *p;
 
   register ssize_t
@@ -1320,7 +1320,10 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
     extent;
 
   ssize_t
-    count;
+    count,
+    horizontal_factor,
+    vertical_factor,
+    y;
 
   time_t
     seconds;
@@ -1361,7 +1364,9 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
       ((horizontal_factor == 2) || (vertical_factor == 2)))
     if ((image->columns % 2) != 0)
       image->columns++;
-  status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+  assert(exception != (ExceptionInfo *) NULL);
+  assert(exception->signature == MagickSignature);
+  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
   if (status == MagickFalse)
     return(status);
   /*
@@ -1399,7 +1404,7 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
       dpx.file.user_size=(((dpx.file.user_size+0x2000-1)/0x2000)*0x2000);
     }
   offset+=WriteBlobLong(image,dpx.file.user_size);
-  value=GetDPXProperty(image_info,image,"dpx:file.filename");
+  value=GetDPXProperty(image_info,image,"dpx:file.filename",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.file.filename,value,sizeof(dpx.file.filename));
   offset+=WriteBlob(image,sizeof(dpx.file.filename),(unsigned char *)
@@ -1411,20 +1416,19 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
     dpx.file.timestamp);
   (void) strncpy(dpx.file.creator,GetMagickVersion((size_t *) NULL),
     sizeof(dpx.file.creator));
-  value=GetDPXProperty(image_info,image,"dpx:file.creator");
+  value=GetDPXProperty(image_info,image,"dpx:file.creator",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.file.creator,value,sizeof(dpx.file.creator));
   offset+=WriteBlob(image,sizeof(dpx.file.creator),(unsigned char *)
     dpx.file.creator);
-  value=GetDPXProperty(image_info,image,"dpx:file.project");
+  value=GetDPXProperty(image_info,image,"dpx:file.project",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.file.project,value,sizeof(dpx.file.project));
   offset+=WriteBlob(image,sizeof(dpx.file.project),(unsigned char *)
     dpx.file.project);
-  value=GetDPXProperty(image_info,image,"dpx:file.copyright");
+  value=GetDPXProperty(image_info,image,"dpx:file.copyright",exception);
   if (value != (const char *) NULL)
-    (void) strncpy(dpx.file.copyright,value,
-      sizeof(dpx.file.copyright));
+    (void) strncpy(dpx.file.copyright,value,sizeof(dpx.file.copyright));
   offset+=WriteBlob(image,sizeof(dpx.file.copyright),(unsigned char *)
     dpx.file.copyright);
   dpx.file.encrypt_key=(~0U);
@@ -1475,7 +1479,7 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
             dpx.image.image_element[i].descriptor=RGBAComponentType;
           if ((image_info->type != TrueColorType) &&
               (image->matte == MagickFalse) &&
-              (IsGrayImage(image,&image->exception) != MagickFalse))
+              (IsImageGray(image,exception) != MagickFalse))
             dpx.image.image_element[i].descriptor=LumaComponentType;
           break;
         }
@@ -1527,36 +1531,36 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
       (void) DeleteImageProperty(image,"dpx:orientation.y_size");
     }
   dpx.orientation.x_offset=0U;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.x_offset");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.x_offset",exception);
   if (value != (const char *) NULL)
     dpx.orientation.x_offset=(unsigned int) StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,dpx.orientation.x_offset);
   dpx.orientation.y_offset=0U;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.y_offset");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.y_offset",exception);
   if (value != (const char *) NULL)
     dpx.orientation.y_offset=(unsigned int) StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,dpx.orientation.y_offset);
   dpx.orientation.x_center=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.x_center");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.x_center",exception);
   if (value != (const char *) NULL)
-    dpx.orientation.x_center=StringToDouble(value);
+    dpx.orientation.x_center=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.orientation.x_center);
   dpx.orientation.y_center=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.y_center");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.y_center",exception);
   if (value != (const char *) NULL)
-    dpx.orientation.y_center=StringToDouble(value);
+    dpx.orientation.y_center=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.orientation.y_center);
   dpx.orientation.x_size=0U;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.x_size");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.x_size",exception);
   if (value != (const char *) NULL)
     dpx.orientation.x_size=(unsigned int) StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,dpx.orientation.x_size);
   dpx.orientation.y_size=0U;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.y_size");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.y_size",exception);
   if (value != (const char *) NULL)
     dpx.orientation.y_size=(unsigned int) StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,dpx.orientation.y_size);
-  value=GetDPXProperty(image_info,image,"dpx:orientation.filename");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.filename",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.orientation.filename,value,
       sizeof(dpx.orientation.filename));
@@ -1564,19 +1568,19 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
     dpx.orientation.filename);
   offset+=WriteBlob(image,sizeof(dpx.orientation.timestamp),(unsigned char *)
     dpx.orientation.timestamp);
-  value=GetDPXProperty(image_info,image,"dpx:orientation.device");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.device",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.orientation.device,value,sizeof(dpx.orientation.device));
   offset+=WriteBlob(image,sizeof(dpx.orientation.device),(unsigned char *)
     dpx.orientation.device);
-  value=GetDPXProperty(image_info,image,"dpx:orientation.serial");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.serial",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.orientation.serial,value,sizeof(dpx.orientation.serial));
   offset+=WriteBlob(image,sizeof(dpx.orientation.serial),(unsigned char *)
     dpx.orientation.serial);
   for (i=0; i < 4; i++)
     dpx.orientation.border[i]=0;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.border");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.border",exception);
   if (value != (const char *) NULL)
     {
       flags=ParseGeometry(value,&geometry_info);
@@ -1591,7 +1595,8 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
     offset+=WriteBlobShort(image,dpx.orientation.border[i]);
   for (i=0; i < 2; i++)
     dpx.orientation.aspect_ratio[i]=0U;
-  value=GetDPXProperty(image_info,image,"dpx:orientation.aspect_ratio");
+  value=GetDPXProperty(image_info,image,"dpx:orientation.aspect_ratio",
+    exception);
   if (value != (const char *) NULL)
     {
       flags=ParseGeometry(value,&geometry_info);
@@ -1608,72 +1613,72 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
     Write film header.
   */
   *dpx.film.id='\0';
-  value=GetDPXProperty(image_info,image,"dpx:film.id");
+  value=GetDPXProperty(image_info,image,"dpx:film.id",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.id,value,sizeof(dpx.film.id));
   offset+=WriteBlob(image,sizeof(dpx.film.id),(unsigned char *) dpx.film.id);
   *dpx.film.type='\0';
-  value=GetDPXProperty(image_info,image,"dpx:film.type");
+  value=GetDPXProperty(image_info,image,"dpx:film.type",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.type,value,sizeof(dpx.film.type));
   offset+=WriteBlob(image,sizeof(dpx.film.type),(unsigned char *)
     dpx.film.type);
   *dpx.film.offset='\0';
-  value=GetDPXProperty(image_info,image,"dpx:film.offset");
+  value=GetDPXProperty(image_info,image,"dpx:film.offset",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.offset,value,sizeof(dpx.film.offset));
   offset+=WriteBlob(image,sizeof(dpx.film.offset),(unsigned char *)
     dpx.film.offset);
   *dpx.film.prefix='\0';
-  value=GetDPXProperty(image_info,image,"dpx:film.prefix");
+  value=GetDPXProperty(image_info,image,"dpx:film.prefix",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.prefix,value,sizeof(dpx.film.prefix));
   offset+=WriteBlob(image,sizeof(dpx.film.prefix),(unsigned char *)
     dpx.film.prefix);
   *dpx.film.count='\0';
-  value=GetDPXProperty(image_info,image,"dpx:film.count");
+  value=GetDPXProperty(image_info,image,"dpx:film.count",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.count,value,sizeof(dpx.film.count));
   offset+=WriteBlob(image,sizeof(dpx.film.count),(unsigned char *)
     dpx.film.count);
   *dpx.film.format='\0';
-  value=GetDPXProperty(image_info,image,"dpx:film.format");
+  value=GetDPXProperty(image_info,image,"dpx:film.format",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.format,value,sizeof(dpx.film.format));
   offset+=WriteBlob(image,sizeof(dpx.film.format),(unsigned char *)
     dpx.film.format);
   dpx.film.frame_position=0U;
-  value=GetDPXProperty(image_info,image,"dpx:film.frame_position");
+  value=GetDPXProperty(image_info,image,"dpx:film.frame_position",exception);
   if (value != (const char *) NULL)
     dpx.film.frame_position=(unsigned int) StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,dpx.film.frame_position);
   dpx.film.sequence_extent=0U;
-  value=GetDPXProperty(image_info,image,"dpx:film.sequence_extent");
+  value=GetDPXProperty(image_info,image,"dpx:film.sequence_extent",exception);
   if (value != (const char *) NULL)
     dpx.film.sequence_extent=(unsigned int) StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,dpx.film.sequence_extent);
   dpx.film.held_count=0U;
-  value=GetDPXProperty(image_info,image,"dpx:film.held_count");
+  value=GetDPXProperty(image_info,image,"dpx:film.held_count",exception);
   if (value != (const char *) NULL)
     dpx.film.held_count=(unsigned int) StringToUnsignedLong(value);
   offset+=WriteBlobLong(image,dpx.film.held_count);
   dpx.film.frame_rate=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:film.frame_rate");
+  value=GetDPXProperty(image_info,image,"dpx:film.frame_rate",exception);
   if (value != (const char *) NULL)
-    dpx.film.frame_rate=StringToDouble(value);
+    dpx.film.frame_rate=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.film.frame_rate);
   dpx.film.shutter_angle=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:film.shutter_angle");
+  value=GetDPXProperty(image_info,image,"dpx:film.shutter_angle",exception);
   if (value != (const char *) NULL)
-    dpx.film.shutter_angle=StringToDouble(value);
+    dpx.film.shutter_angle=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.film.shutter_angle);
   *dpx.film.frame_id='\0';
-  value=GetDPXProperty(image_info,image,"dpx:film.frame_id");
+  value=GetDPXProperty(image_info,image,"dpx:film.frame_id",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.frame_id,value,sizeof(dpx.film.frame_id));
   offset+=WriteBlob(image,sizeof(dpx.film.frame_id),(unsigned char *)
     dpx.film.frame_id);
-  value=GetDPXProperty(image_info,image,"dpx:film.slate");
+  value=GetDPXProperty(image_info,image,"dpx:film.slate",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.film.slate,value,sizeof(dpx.film.slate));
   offset+=WriteBlob(image,sizeof(dpx.film.slate),(unsigned char *)
@@ -1683,89 +1688,92 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
   /*
     Write television header.
   */
-  value=GetDPXProperty(image_info,image,"dpx:television.time.code");
+  value=GetDPXProperty(image_info,image,"dpx:television.time.code",exception);
   if (value != (const char *) NULL)
     dpx.television.time_code=StringToTimeCode(value);
   offset+=WriteBlobLong(image,dpx.television.time_code);
-  value=GetDPXProperty(image_info,image,"dpx:television.user.bits");
+  value=GetDPXProperty(image_info,image,"dpx:television.user.bits",exception);
   if (value != (const char *) NULL)
     dpx.television.user_bits=StringToTimeCode(value);
   offset+=WriteBlobLong(image,dpx.television.user_bits);
-  value=GetDPXProperty(image_info,image,"dpx:television.interlace");
+  value=GetDPXProperty(image_info,image,"dpx:television.interlace",exception);
   if (value != (const char *) NULL)
     dpx.television.interlace=(unsigned char) StringToLong(value);
   offset+=WriteBlobByte(image,dpx.television.interlace);
-  value=GetDPXProperty(image_info,image,"dpx:television.field_number");
+  value=GetDPXProperty(image_info,image,"dpx:television.field_number",
+    exception);
   if (value != (const char *) NULL)
     dpx.television.field_number=(unsigned char) StringToLong(value);
   offset+=WriteBlobByte(image,dpx.television.field_number);
   dpx.television.video_signal=0;
-  value=GetDPXProperty(image_info,image,"dpx:television.video_signal");
+  value=GetDPXProperty(image_info,image,"dpx:television.video_signal",
+    exception);
   if (value != (const char *) NULL)
     dpx.television.video_signal=(unsigned char) StringToLong(value);
   offset+=WriteBlobByte(image,dpx.television.video_signal);
   dpx.television.padding=0;
-  value=GetDPXProperty(image_info,image,"dpx:television.padding");
+  value=GetDPXProperty(image_info,image,"dpx:television.padding",exception);
   if (value != (const char *) NULL)
     dpx.television.padding=(unsigned char) StringToLong(value);
   offset+=WriteBlobByte(image,dpx.television.padding);
   dpx.television.horizontal_sample_rate=0.0f;
-  value=GetDPXProperty(image_info,image,
-    "dpx:television.horizontal_sample_rate");
+  value=GetDPXProperty(image_info,image,"dpx:television.horizontal_sample_rate",    exception);
   if (value != (const char *) NULL)
-    dpx.television.horizontal_sample_rate=StringToDouble(value);
+    dpx.television.horizontal_sample_rate=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.horizontal_sample_rate);
   dpx.television.vertical_sample_rate=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.vertical_sample_rate");
+  value=GetDPXProperty(image_info,image,"dpx:television.vertical_sample_rate",
+    exception);
   if (value != (const char *) NULL)
-    dpx.television.vertical_sample_rate=StringToDouble(value);
+    dpx.television.vertical_sample_rate=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.vertical_sample_rate);
   dpx.television.frame_rate=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.frame_rate");
+  value=GetDPXProperty(image_info,image,"dpx:television.frame_rate",exception);
   if (value != (const char *) NULL)
-    dpx.television.frame_rate=StringToDouble(value);
+    dpx.television.frame_rate=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.frame_rate);
   dpx.television.time_offset=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.time_offset");
+  value=GetDPXProperty(image_info,image,"dpx:television.time_offset",exception);
   if (value != (const char *) NULL)
-    dpx.television.time_offset=StringToDouble(value);
+    dpx.television.time_offset=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.time_offset);
   dpx.television.gamma=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.gamma");
+  value=GetDPXProperty(image_info,image,"dpx:television.gamma",exception);
   if (value != (const char *) NULL)
-    dpx.television.gamma=StringToDouble(value);
+    dpx.television.gamma=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.gamma);
   dpx.television.black_level=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.black_level");
+  value=GetDPXProperty(image_info,image,"dpx:television.black_level",exception);
   if (value != (const char *) NULL)
-    dpx.television.black_level=StringToDouble(value);
+    dpx.television.black_level=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.black_level);
   dpx.television.black_gain=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.black_gain");
+  value=GetDPXProperty(image_info,image,"dpx:television.black_gain",exception);
   if (value != (const char *) NULL)
-    dpx.television.black_gain=StringToDouble(value);
+    dpx.television.black_gain=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.black_gain);
   dpx.television.break_point=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.break_point");
+  value=GetDPXProperty(image_info,image,"dpx:television.break_point",exception);
   if (value != (const char *) NULL)
-    dpx.television.break_point=StringToDouble(value);
+    dpx.television.break_point=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.break_point);
   dpx.television.white_level=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.white_level");
+  value=GetDPXProperty(image_info,image,"dpx:television.white_level",exception);
   if (value != (const char *) NULL)
-    dpx.television.white_level=StringToDouble(value);
+    dpx.television.white_level=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.white_level);
   dpx.television.integration_times=0.0f;
-  value=GetDPXProperty(image_info,image,"dpx:television.integration_times");
+  value=GetDPXProperty(image_info,image,"dpx:television.integration_times",
+    exception);
   if (value != (const char *) NULL)
-    dpx.television.integration_times=StringToDouble(value);
+    dpx.television.integration_times=StringToDouble(value,(char **) NULL);
   offset+=WriteBlobFloat(image,dpx.television.integration_times);
   offset+=WriteBlob(image,sizeof(dpx.television.reserve),(unsigned char *)
     dpx.television.reserve);
   /*
     Write user header.
   */
-  value=GetDPXProperty(image_info,image,"dpx:user.id");
+  value=GetDPXProperty(image_info,image,"dpx:user.id",exception);
   if (value != (const char *) NULL)
     (void) strncpy(dpx.user.id,value,sizeof(dpx.user.id));
   offset+=WriteBlob(image,sizeof(dpx.user.id),(unsigned char *) dpx.user.id);
@@ -1777,7 +1785,7 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
     count=WriteBlobByte(image,0x00);
     if (count != 1)
       {
-        ThrowFileException(&image->exception,FileOpenError,"UnableToWriteFile",
+        ThrowFileException(exception,FileOpenError,"UnableToWriteFile",
           image->filename);
         break;
       }
@@ -1804,7 +1812,7 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
   extent=GetBytesPerRow(image->columns,image->matte != MagickFalse ? 4UL : 3UL,
     image->depth,MagickTrue);
   if ((image_info->type != TrueColorType) && (image->matte == MagickFalse) &&
-      (IsGrayImage(image,&image->exception) != MagickFalse))
+      (IsImageGray(image,exception) != MagickFalse))
     {
       quantum_type=GrayQuantum;
       extent=GetBytesPerRow(image->columns,1UL,image->depth,MagickTrue);
@@ -1812,16 +1820,16 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image)
   pixels=GetQuantumPixels(quantum_info);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
-    p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-    if (p == (const PixelPacket *) NULL)
+    p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+    if (p == (const Quantum *) NULL)
       break;
-    (void) ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
-      quantum_type,pixels,&image->exception);
+    (void) ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
+      quantum_type,pixels,exception);
     count=WriteBlob(image,extent,pixels);
     if (count != (ssize_t) extent)
       break;
     status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
-                image->rows);
+      image->rows);
     if (status == MagickFalse)
       break;
   }