]> granicus.if.org Git - imagemagick/blobdiff - Magick++/lib/Image.cpp
(no commit message)
[imagemagick] / Magick++ / lib / Image.cpp
index f61ef476dfa1534960c2c7c7bb6cc1206896f21a..9fc284b7e9e387a6e744ef031ee91c839c489e62 100644 (file)
@@ -8,15 +8,12 @@
 #define MAGICKCORE_IMPLEMENTATION  1
 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
 
-#include "Magick++/Include.h"
 #include <cstdlib>
 #include <string>
 #include <string.h>
 #include <errno.h>
 #include <math.h>
-#if !defined(__WINDOWS__)
-#include <strings.h>
-#endif
+#include "Magick++/Include.h"
 
 using namespace std;
 
@@ -27,12 +24,11 @@ using namespace std;
 #include "Magick++/ImageRef.h"
 
 #define AbsoluteValue(x)  ((x) < 0 ? -(x) : (x))
-#define MagickPI  3.14159265358979323846264338327950288419716939937510
 #define DegreesToRadians(x)  (MagickPI*(x)/180.0)
 
-MagickDLLDeclExtern const char *Magick::borderGeometryDefault = "6x6+0+0";
-MagickDLLDeclExtern const char *Magick::frameGeometryDefault  = "25x25+6+6";
-MagickDLLDeclExtern const char *Magick::raiseGeometryDefault  = "6x6+0+0";
+MagickPPExport const char *Magick::borderGeometryDefault = "6x6+0+0";
+MagickPPExport const char *Magick::frameGeometryDefault  = "25x25+6+6";
+MagickPPExport const char *Magick::raiseGeometryDefault  = "6x6+0+0";
 
 static bool magick_initialized=false;
 
@@ -44,7 +40,7 @@ static bool magick_initialized=false;
 // Friend functions to compare Image objects
 //
 
-MagickDLLDecl int Magick::operator == ( const Magick::Image& left_,
+MagickPPExport int Magick::operator == ( const Magick::Image& left_,
                                         const Magick::Image& right_ )
 {
   // If image pixels and signature are the same, then the image is identical
@@ -53,17 +49,17 @@ MagickDLLDecl int Magick::operator == ( const Magick::Image& left_,
           ( left_.signature() == right_.signature() )
           );
 }
-MagickDLLDecl int Magick::operator != ( const Magick::Image& left_,
+MagickPPExport int Magick::operator != ( const Magick::Image& left_,
                                         const Magick::Image& right_ )
 {
   return ( ! (left_ == right_) );
 }
-MagickDLLDecl int Magick::operator >  ( const Magick::Image& left_,
+MagickPPExport int Magick::operator >  ( const Magick::Image& left_,
                                         const Magick::Image& right_ )
 {
   return ( !( left_ < right_ ) && ( left_ != right_ ) );
 }
-MagickDLLDecl int Magick::operator <  ( const Magick::Image& left_,
+MagickPPExport int Magick::operator <  ( const Magick::Image& left_,
                                         const Magick::Image& right_ )
 {
   // If image pixels are less, then image is smaller
@@ -71,12 +67,12 @@ MagickDLLDecl int Magick::operator <  ( const Magick::Image& left_,
           ( right_.rows() * right_.columns() )
           );
 }
-MagickDLLDecl int Magick::operator >= ( const Magick::Image& left_,
+MagickPPExport int Magick::operator >= ( const Magick::Image& left_,
                                         const Magick::Image& right_ )
 {
   return ( ( left_ > right_ ) || ( left_ == right_ ) );
 }
-MagickDLLDecl int Magick::operator <= ( const Magick::Image& left_,
+MagickPPExport int Magick::operator <= ( const Magick::Image& left_,
                                         const Magick::Image& right_ )
 {
   return ( ( left_ < right_ ) || ( left_ == right_ ) );
@@ -182,7 +178,7 @@ Magick::Image::Image ( const Blob &blob_,
 // Construct Image of specified size and depth from in-memory BLOB
 Magick::Image::Image ( const Blob &blob_,
                       const Geometry &size_,
-                      const unsigned int depth_ )
+                      const size_t depth_ )
   : _imgRef(new ImageRef)
 {
   try
@@ -205,7 +201,7 @@ Magick::Image::Image ( const Blob &blob_,
 // Construct Image of specified size, depth, and format from in-memory BLOB
 Magick::Image::Image ( const Blob &blob_,
                       const Geometry &size_,
-                      const unsigned int depth_,
+                      const size_t depth_,
                       const std::string &magick_ )
   : _imgRef(new ImageRef)
 {
@@ -251,8 +247,8 @@ Magick::Image::Image ( const Blob &blob_,
 
 // Construct an image based on an array of raw pixels, of specified
 // type and mapping, in memory
-Magick::Image::Image ( const unsigned int width_,
-                       const unsigned int height_,
+Magick::Image::Image ( const size_t width_,
+                       const size_t height_,
                        const std::string &map_,
                        const StorageType type_,
                        const void *pixels_ )
@@ -304,7 +300,7 @@ void Magick::Image::adaptiveBlur( const double radius_, const double sigma_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    AdaptiveBlurImage( image(), radius_, sigma_, &exceptionInfo);
+    AdaptiveBlurImage( image(), radius_, sigma_, image()->bias, &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -314,9 +310,9 @@ void Magick::Image::adaptiveBlur( const double radius_, const double sigma_ )
 // http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm
 // Width x height define the size of the pixel neighborhood
 // offset = constant to subtract from pixel neighborhood mean
-void Magick::Image::adaptiveThreshold ( const unsigned int width_,
-                                        const unsigned int height_,
-                                        const unsigned int offset_ )
+void Magick::Image::adaptiveThreshold ( const size_t width_,
+                                        const size_t height_,
+                                        const ssize_t offset_ )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
@@ -346,11 +342,12 @@ void Magick::Image::addNoiseChannel( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
   MagickCore::Image* newImage =
-    AddNoiseImageChannel ( image(),
-                           channel_,
+    AddNoiseImage ( image(),
                            noiseType_,
                            &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -410,8 +407,8 @@ void Magick::Image::annotate ( const std::string &text_,
   if ( boundingArea_.isValid() ){
     if ( boundingArea_.width() == 0 || boundingArea_.height() == 0 )
       {
-        FormatMagickString( boundingArea, MaxTextExtent, "+%u+%u",
-                      boundingArea_.xOff(), boundingArea_.yOff() );
+        FormatLocaleString( boundingArea, MaxTextExtent, "%+.20g%+.20g",
+          (double) boundingArea_.xOff(), (double) boundingArea_.yOff() );
       }
     else
       {
@@ -448,14 +445,17 @@ void Magick::Image::annotate ( const std::string &text_,
           +current.tx;
     }
 
-  AnnotateImage( image(), drawInfo );
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  AnnotateImage( image(), drawInfo, &exceptionInfo );
 
   // Restore original values
   drawInfo->affine = oaffine;
   drawInfo->text = 0;
   drawInfo->geometry = 0;
 
-  throwImageException();
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 // Annotate with text (bounding area is entire image) and placement gravity.
 void Magick::Image::annotate ( const std::string &text_,
@@ -470,12 +470,15 @@ void Magick::Image::annotate ( const std::string &text_,
 
   drawInfo->gravity = gravity_;
 
-  AnnotateImage( image(), drawInfo );
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  AnnotateImage( image(), drawInfo, &exceptionInfo );
 
   drawInfo->gravity = NorthWestGravity;
   drawInfo->text = 0;
 
-  throwImageException();
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Blur image
@@ -484,7 +487,7 @@ void Magick::Image::blur( const double radius_, const double sigma_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    BlurImage( image(), radius_, sigma_, &exceptionInfo);
+    BlurImage( image(), radius_, sigma_, image()->bias, &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -495,8 +498,10 @@ void Magick::Image::blurChannel( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
-    BlurImageChannel( image(), channel_,radius_, sigma_, &exceptionInfo);
+    BlurImage( image(), radius_, sigma_, image()->bias, &exceptionInfo);
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -510,7 +515,7 @@ void Magick::Image::border( const Geometry &geometry_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    BorderImage( image(), &borderInfo, &exceptionInfo);
+    BorderImage( image(), &borderInfo, image()->compose, &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -520,26 +525,26 @@ void Magick::Image::border( const Geometry &geometry_ )
 void Magick::Image::channel ( const ChannelType channel_ )
 {
   modifyImage();
-  SeparateImageChannel ( image(), channel_ );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
+  SeparateImage ( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   throwImageException();
 }
 
 // Set or obtain modulus channel depth
-void Magick::Image::channelDepth ( const ChannelType channel_,
-                                   const unsigned int depth_)
+void Magick::Image::channelDepth ( const size_t depth_ )
 {
   modifyImage();
-  SetImageChannelDepth( image(), channel_, depth_);
+  SetImageDepth( image(), depth_);
   throwImageException();
 }
-unsigned int Magick::Image::channelDepth ( const ChannelType channel_ )
+size_t Magick::Image::channelDepth ( )
 {
-  unsigned int channel_depth;
+  size_t channel_depth;
 
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  channel_depth=GetImageChannelDepth( constImage(), channel_,
-                                      &exceptionInfo );
+  channel_depth=GetImageDepth( constImage(), &exceptionInfo );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
   return channel_depth;
@@ -552,7 +557,7 @@ void Magick::Image::charcoal( const double radius_, const double sigma_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    CharcoalImage( image(), radius_, sigma_, &exceptionInfo );
+    CharcoalImage( image(), radius_, sigma_, image()->bias, &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -576,14 +581,17 @@ void Magick::Image::chop( const Geometry &geometry_ )
 void Magick::Image::cdl ( const std::string &cdl_ )
 {
   modifyImage();
-  (void) ColorDecisionListImage( image(), cdl_.c_str() );
-  throwImageException();
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  (void) ColorDecisionListImage( image(), cdl_.c_str(), &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Colorize
-void Magick::Image::colorize ( const unsigned int opacityRed_,
-                               const unsigned int opacityGreen_,
-                               const unsigned int opacityBlue_,
+void Magick::Image::colorize ( const unsigned int alphaRed_,
+                               const unsigned int alphaGreen_,
+                               const unsigned int alphaBlue_,
                               const Color &penColor_ )
 {
   if ( !penColor_.isValid() )
@@ -592,22 +600,45 @@ void Magick::Image::colorize ( const unsigned int opacityRed_,
                            "Pen color argument is invalid");
   }
 
-  char opacity[MaxTextExtent];
-  FormatMagickString(opacity,MaxTextExtent,"%u/%u/%u",opacityRed_,opacityGreen_,opacityBlue_);
+  char alpha[MaxTextExtent];
+  FormatLocaleString(alpha,MaxTextExtent,"%u/%u/%u",alphaRed_,alphaGreen_,alphaBlue_);
 
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-  ColorizeImage ( image(), opacity,
+  ColorizeImage ( image(), alpha,
                  penColor_, &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
-void Magick::Image::colorize ( const unsigned int opacity_,
+void Magick::Image::colorize ( const unsigned int alpha_,
                               const Color &penColor_ )
 {
-  colorize( opacity_, opacity_, opacity_, penColor_ );
+  colorize( alpha_, alpha_, alpha_, penColor_ );
+}
+
+// Apply a color matrix to the image channels.  The user supplied
+// matrix may be of order 1 to 6 (1x1 through 6x6).
+void Magick::Image::colorMatrix (const size_t order_,
+         const double *color_matrix_)
+{
+  KernelInfo
+    *kernel_info;
+
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  kernel_info=AcquireKernelInfo((const char *) NULL);
+  kernel_info->width=order_;
+  kernel_info->height=order_;
+  kernel_info->values=(double *) color_matrix_;
+  MagickCore::Image* newImage =
+    ColorMatrixImage( image(), kernel_info, &exceptionInfo );
+  kernel_info->values=(double *) NULL;
+  kernel_info=DestroyKernelInfo(kernel_info);
+  replaceImage( newImage );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Compare current image with another image
@@ -615,16 +646,22 @@ void Magick::Image::colorize ( const unsigned int opacity_,
 // in the current image. False is returned if the images are identical.
 bool Magick::Image::compare ( const Image &reference_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
   Image ref = reference_;
   ref.modifyImage();
-  return static_cast<bool>(IsImagesEqual(image(), ref.image()));
+  bool status =
+    static_cast<bool>(IsImagesEqual(image(), ref.image(), &exceptionInfo));
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+  return status;
 }
 
 // Composite two images
 void Magick::Image::composite ( const Image &compositeImage_,
-                               const int xOffset_,
-                               const int yOffset_,
+                               const ssize_t xOffset_,
+                               const ssize_t yOffset_,
                                const CompositeOperator compose_ )
 {
   // Image supplied as compositeImage is composited with current image and
@@ -644,10 +681,10 @@ void Magick::Image::composite ( const Image &compositeImage_,
 {
   modifyImage();
 
-  long x = offset_.xOff();
-  long y = offset_.yOff();
-  unsigned long width = columns();
-  unsigned long height = rows();
+  ssize_t x = offset_.xOff();
+  ssize_t y = offset_.yOff();
+  size_t width = columns();
+  size_t height = rows();
 
   ParseMetaGeometry (static_cast<std::string>(offset_).c_str(),
                      &x, &y,
@@ -678,24 +715,36 @@ void Magick::Image::composite ( const Image &compositeImage_,
 }
 
 // Contrast image
-void Magick::Image::contrast ( const unsigned int sharpen_ )
+void Magick::Image::contrast ( const size_t sharpen_ )
 {
   modifyImage();
-  ContrastImage ( image(), (MagickBooleanType) sharpen_ );
-  throwImageException();
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  ContrastImage ( image(), (MagickBooleanType) sharpen_, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Convolve image.  Applies a general image convolution kernel to the image.
 //  order_ represents the number of columns and rows in the filter kernel.
 //  kernel_ is an array of doubles representing the convolution kernel.
-void Magick::Image::convolve ( const unsigned int order_,
+void Magick::Image::convolve ( const size_t order_,
                                const double *kernel_ )
 {
+  KernelInfo
+    *kernel_info;
+
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
+  kernel_info=AcquireKernelInfo((const char *) NULL);
+  kernel_info->width=order_;
+  kernel_info->height=order_;
+  kernel_info->values=(double *) kernel_;
+  kernel_info->bias=image()->bias;
   MagickCore::Image* newImage =
-  ConvolveImage ( image(), order_,
-                 kernel_, &exceptionInfo );
+    ConvolveImage ( image(), kernel_info, &exceptionInfo );
+  kernel_info->values=(double *) NULL;
+  kernel_info=DestroyKernelInfo(kernel_info);
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -717,11 +766,14 @@ void Magick::Image::crop ( const Geometry &geometry_ )
 }
 
 // Cycle Color Map
-void Magick::Image::cycleColormap ( const int amount_ )
+void Magick::Image::cycleColormap ( const ssize_t amount_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  CycleColormapImage( image(), amount_ );
-  throwImageException();
+  CycleColormapImage( image(), amount_, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Despeckle
@@ -739,7 +791,11 @@ void Magick::Image::despeckle ( void )
 // Display image
 void Magick::Image::display( void )
 {
-  DisplayImages( imageInfo(), image() );
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  DisplayImages( imageInfo(), image(), &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Distort image.  distorts an image using various distortion methods, by
@@ -747,7 +803,7 @@ void Magick::Image::display( void )
 // usally of the same size as the source image, unless 'bestfit' is set to
 // true.
 void Magick::Image::distort ( const DistortImageMethod method_,
-                              const unsigned long number_arguments_,
+                              const size_t number_arguments_,
                               const double *arguments_,
                               const bool bestfit_ )
 {
@@ -808,12 +864,12 @@ void Magick::Image::draw ( const std::list<Magick::Drawable> &drawable_ )
 }
 
 // Hilight edges in image
-void Magick::Image::edge ( const double radius_ )
+void Magick::Image::edge ( const double radius_, const double sigma_ )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    EdgeImage( image(), radius_, &exceptionInfo );
+    EdgeImage( image(), radius_, sigma_, &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -846,9 +902,11 @@ void Magick::Image::enhance ( void )
 // Equalize image (histogram equalization)
 void Magick::Image::equalize ( void )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  EqualizeImage( image() );
-  throwImageException();
+  EqualizeImage( image(), &exceptionInfo );
+  throwException( exceptionInfo );
 }
 
 // Erase image to current "background color"
@@ -865,8 +923,29 @@ void Magick::Image::extent ( const Geometry &geometry_ )
 {
   RectangleInfo extentInfo = geometry_;
   modifyImage();
-  SetImageExtent ( image(), extentInfo.width, extentInfo.height);
-  throwImageException();
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  MagickCore::Image* newImage =
+    ExtentImage ( image(), &extentInfo, &exceptionInfo );
+  replaceImage( newImage );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+}
+void Magick::Image::extent ( const Geometry &geometry_, const Color &backgroundColor_ )
+{
+  backgroundColor ( backgroundColor_ );
+  extent ( geometry_ );
+}
+void Magick::Image::extent ( const Geometry &geometry_, const GravityType gravity_ )
+{
+  image()->gravity  = gravity_;
+  extent ( geometry_ );
+}
+void Magick::Image::extent ( const Geometry &geometry_, const Color &backgroundColor_, const GravityType gravity_ )
+{
+  image()->gravity  = gravity_;
+  backgroundColor ( backgroundColor_ );
+  extent ( geometry_ );
 }
 
 // Flip image (reflect each scanline in the vertical direction)
@@ -884,8 +963,8 @@ void Magick::Image::flip ( void )
 // Flood-fill color across pixels that match the color of the
 // target pixel and are neighbors of the target pixel.
 // Uses current fuzz setting when determining color match.
-void Magick::Image::floodFillColor( const unsigned int x_,
-                                    const unsigned int y_,
+void Magick::Image::floodFillColor( const ssize_t x_,
+                                    const ssize_t y_,
                                    const Magick::Color &fillColor_ )
 {
   floodFillTexture( x_, y_, Image( Geometry( 1, 1), fillColor_ ) );
@@ -899,8 +978,8 @@ void Magick::Image::floodFillColor( const Geometry &point_,
 // Flood-fill color across pixels starting at target-pixel and
 // stopping at pixels matching specified border color.
 // Uses current fuzz setting when determining color match.
-void Magick::Image::floodFillColor( const unsigned int x_,
-                                    const unsigned int y_,
+void Magick::Image::floodFillColor( const ssize_t x_,
+                                    const ssize_t y_,
                                    const Magick::Color &fillColor_,
                                    const Magick::Color &borderColor_ )
 {
@@ -916,34 +995,37 @@ void Magick::Image::floodFillColor( const Geometry &point_,
 }
 
 // Floodfill pixels matching color (within fuzz factor) of target
-// pixel(x,y) with replacement opacity value using method.
-void Magick::Image::floodFillOpacity( const unsigned int x_,
-                                      const unsigned int y_,
-                                      const unsigned int opacity_,
+// pixel(x,y) with replacement alpha value using method.
+void Magick::Image::floodFillOpacity( const ssize_t x_,
+                                      const ssize_t y_,
+                                      const unsigned int alpha_,
                                       const PaintMethod method_ )
 {
   modifyImage();
-  MagickPixelPacket target;
-  GetMagickPixelPacket(image(),&target);
+  PixelInfo target;
+  GetPixelInfo(image(),&target);
   PixelPacket pixel=static_cast<PixelPacket>(pixelColor(x_,y_));
   target.red=pixel.red;
   target.green=pixel.green;
   target.blue=pixel.blue;
-  target.opacity=opacity_;
+  target.alpha=alpha_;
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   FloodfillPaintImage ( image(),
-                        DefaultChannels,
                         options()->drawInfo(), // const DrawInfo *draw_info
                         &target,
-                                       static_cast<long>(x_), static_cast<long>(y_),
-                        method_  == FloodfillMethod ? MagickFalse : MagickTrue);
-  throwImageException();
+                                       static_cast<ssize_t>(x_), static_cast<ssize_t>(y_),
+                        method_  == FloodfillMethod ? MagickFalse : MagickTrue,
+    &exceptionInfo);
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Flood-fill texture across pixels that match the color of the
 // target pixel and are neighbors of the target pixel.
 // Uses current fuzz setting when determining color match.
-void Magick::Image::floodFillTexture( const unsigned int x_,
-                                      const unsigned int y_,
+void Magick::Image::floodFillTexture( const ssize_t x_,
+                                      const ssize_t y_,
                                      const Magick::Image &texture_ )
 {
   modifyImage();
@@ -954,23 +1036,25 @@ void Magick::Image::floodFillTexture( const unsigned int x_,
   // Get pixel view
   Pixels pixels(*this);
   // Fill image
-  PixelPacket *p = pixels.get(x_, y_, 1, 1 );
-  MagickPixelPacket target;
-  GetMagickPixelPacket(constImage(),&target);
-  target.red=p->red;
-  target.green=p->green;
-  target.blue=p->blue;
+  Quantum *p = pixels.get(x_, y_, 1, 1 );
+  PixelInfo target;
+  GetPixelInfo(constImage(),&target);
+  target.red=GetPixelRed(constImage(),p);
+  target.green=GetPixelGreen(constImage(),p);
+  target.blue=GetPixelBlue(constImage(),p);
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   if (p)
     FloodfillPaintImage ( image(), // Image *image
-                          DefaultChannels,
                           options()->drawInfo(), // const DrawInfo *draw_info
                           &target, // const MagickPacket target
-                          static_cast<long>(x_), // const long x_offset
-                          static_cast<long>(y_), // const long y_offset
-                          MagickFalse // const PaintMethod method
-      );
+                          static_cast<ssize_t>(x_), // const ssize_t x_offset
+                          static_cast<ssize_t>(y_), // const ssize_t y_offset
+                          MagickFalse, // const PaintMethod method
+      &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 
-  throwImageException();
 }
 void Magick::Image::floodFillTexture( const Magick::Geometry &point_,
                                      const Magick::Image &texture_ )
@@ -981,8 +1065,8 @@ void Magick::Image::floodFillTexture( const Magick::Geometry &point_,
 // Flood-fill texture across pixels starting at target-pixel and
 // stopping at pixels matching specified border color.
 // Uses current fuzz setting when determining color match.
-void Magick::Image::floodFillTexture( const unsigned int x_,
-                                      const unsigned int y_,
+void Magick::Image::floodFillTexture( const ssize_t x_,
+                                      const ssize_t y_,
                                      const Magick::Image &texture_,
                                      const Magick::Color &borderColor_ )
 {
@@ -991,20 +1075,22 @@ void Magick::Image::floodFillTexture( const unsigned int x_,
   // Set drawing fill pattern
   options()->fillPattern(texture_.constImage());
 
-  MagickPixelPacket target;
-  GetMagickPixelPacket(constImage(),&target);
+  PixelInfo target;
+  GetPixelInfo(constImage(),&target);
   target.red=static_cast<PixelPacket>(borderColor_).red;
   target.green=static_cast<PixelPacket>(borderColor_).green;
   target.blue=static_cast<PixelPacket>(borderColor_).blue;
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   FloodfillPaintImage ( image(),
-                        DefaultChannels,
                         options()->drawInfo(),
                         &target,
-                        static_cast<long>(x_),
-                        static_cast<long>(y_),
-                        MagickTrue);
+                        static_cast<ssize_t>(x_),
+                        static_cast<ssize_t>(y_),
+                        MagickTrue, &exceptionInfo);
 
-  throwImageException();
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 void  Magick::Image::floodFillTexture( const Magick::Geometry &point_,
                                       const Magick::Image &texture_,
@@ -1025,65 +1111,42 @@ void Magick::Image::flop ( void )
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
-// Implements the discrete Fourier transform (DFT) of the image either as a
-// magnitude / phase or real / imaginary image pair.
-void Magick::Image::forwardFourierTransform ( void )
-{
-  ExceptionInfo exceptionInfo;
-  GetExceptionInfo( &exceptionInfo );
-  MagickCore::Image* newImage = ForwardFourierTransformImage ( image(),
-    MagickTrue, &exceptionInfo );
-  replaceImage( newImage );
-  throwException( exceptionInfo );
-  (void) DestroyExceptionInfo( &exceptionInfo );
-}
-void Magick::Image::forwardFourierTransform ( const bool magnitude )
-{
-  ExceptionInfo exceptionInfo;
-  GetExceptionInfo( &exceptionInfo );
-  MagickCore::Image* newImage = ForwardFourierTransformImage ( image(),
-    magnitude == true ? MagickTrue : MagickFalse, &exceptionInfo );
-  replaceImage( newImage );
-  throwException( exceptionInfo );
-  (void) DestroyExceptionInfo( &exceptionInfo );
-}
-
 // Frame image
 void Magick::Image::frame ( const Geometry &geometry_ )
 {
   FrameInfo info;
 
-  info.x           = static_cast<long>(geometry_.width());
-  info.y           = static_cast<long>(geometry_.height());
-  info.width       = columns() + ( static_cast<unsigned long>(info.x) << 1 );
-  info.height      = rows() + ( static_cast<unsigned long>(info.y) << 1 );
+  info.x           = static_cast<ssize_t>(geometry_.width());
+  info.y           = static_cast<ssize_t>(geometry_.height());
+  info.width       = columns() + ( static_cast<size_t>(info.x) << 1 );
+  info.height      = rows() + ( static_cast<size_t>(info.y) << 1 );
   info.outer_bevel = geometry_.xOff();
   info.inner_bevel = geometry_.yOff();
 
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    FrameImage( image(), &info, &exceptionInfo );
+    FrameImage( image(), &info, image()->compose, &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
-void Magick::Image::frame ( const unsigned int width_,
-                            const unsigned int height_,
-                           const int outerBevel_, const int innerBevel_ )
+void Magick::Image::frame ( const size_t width_,
+                            const size_t height_,
+                           const ssize_t outerBevel_, const ssize_t innerBevel_ )
 {
   FrameInfo info;
-  info.x           = static_cast<long>(width_);
-  info.y           = static_cast<long>(height_);
-  info.width       = columns() + ( static_cast<unsigned long>(info.x) << 1 );
-  info.height      = rows() + ( static_cast<unsigned long>(info.y) << 1 );
-  info.outer_bevel = static_cast<long>(outerBevel_);
-  info.inner_bevel = static_cast<long>(innerBevel_);
+  info.x           = static_cast<ssize_t>(width_);
+  info.y           = static_cast<ssize_t>(height_);
+  info.width       = columns() + ( static_cast<size_t>(info.x) << 1 );
+  info.height      = rows() + ( static_cast<size_t>(info.y) << 1 );
+  info.outer_bevel = static_cast<ssize_t>(outerBevel_);
+  info.inner_bevel = static_cast<ssize_t>(innerBevel_);
 
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    FrameImage( image(), &info, &exceptionInfo );
+    FrameImage( image(), &info, image()->compose, &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1095,7 +1158,7 @@ void Magick::Image::fx ( const std::string expression )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    FxImageChannel ( image(), DefaultChannels, expression.c_str(), &exceptionInfo );
+    FxImage ( image(), expression.c_str(), &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1105,8 +1168,10 @@ void Magick::Image::fx ( const std::string expression,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel );
   MagickCore::Image* newImage =
-    FxImageChannel ( image(), channel, expression.c_str(), &exceptionInfo );
+    FxImage ( image(), expression.c_str(), &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1115,11 +1180,12 @@ void Magick::Image::fx ( const std::string expression,
 // Gamma correct image
 void Magick::Image::gamma ( const double gamma_ )
 {
-  char gamma[MaxTextExtent + 1];
-  FormatMagickString( gamma, MaxTextExtent, "%3.6f", gamma_);
-
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  GammaImage ( image(), gamma );
+  GammaImage ( image(), gamma_, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 void Magick::Image::gamma ( const double gammaRed_,
@@ -1127,12 +1193,15 @@ void Magick::Image::gamma ( const double gammaRed_,
                            const double gammaBlue_ )
 {
   char gamma[MaxTextExtent + 1];
-  FormatMagickString( gamma, MaxTextExtent, "%3.6f/%3.6f/%3.6f/",
+  FormatLocaleString( gamma, MaxTextExtent, "%3.6f/%3.6f/%3.6f/",
                gammaRed_, gammaGreen_, gammaBlue_);
 
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  GammaImage ( image(), gamma );
-  throwImageException();
+  GammaImage ( image(), atof(gamma), &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Gaussian blur image
@@ -1144,7 +1213,7 @@ void Magick::Image::gaussianBlur ( const double width_, const double sigma_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    GaussianBlurImage( image(), width_, sigma_, &exceptionInfo );
+    GaussianBlurImage( image(), width_, sigma_, image()->bias, &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1156,8 +1225,10 @@ void Magick::Image::gaussianBlurChannel ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
-    GaussianBlurImageChannel( image(), channel_, width_, sigma_, &exceptionInfo );
+    GaussianBlurImage( image(), width_, sigma_, image()->bias, &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1166,9 +1237,12 @@ void Magick::Image::gaussianBlurChannel ( const ChannelType channel_,
 // Apply a color lookup table (Hald CLUT) to the image.
 void  Magick::Image::haldClut ( const Image &clutImage_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  (void) HaldClutImage( image(), clutImage_.constImage() );
-  throwImageException();
+  (void) HaldClutImage( image(), clutImage_.constImage(), &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Implode image
@@ -1177,7 +1251,32 @@ void Magick::Image::implode ( const double factor_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    ImplodeImage( image(), factor_, &exceptionInfo );
+    ImplodeImage( image(), factor_, image()->interpolate, &exceptionInfo );
+  replaceImage( newImage );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
+// implements the inverse discrete Fourier transform (IFT) of the image either
+// as a magnitude / phase or real / imaginary image pair.
+void Magick::Image::inverseFourierTransform ( const Image &phase_ )
+{
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  MagickCore::Image* newImage = InverseFourierTransformImage( image(),
+                phase_.constImage(), MagickTrue, &exceptionInfo);
+  replaceImage( newImage );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+}
+void Magick::Image::inverseFourierTransform ( const Image &phase_,
+   const bool magnitude_ )
+{
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  MagickCore::Image* newImage = InverseFourierTransformImage( image(),
+                phase_.constImage(), magnitude_ == true ? MagickTrue : MagickFalse,
+     &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1197,33 +1296,12 @@ void Magick::Image::level ( const double black_point,
                             const double white_point,
                             const double gamma )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  char levels[MaxTextExtent];
-  FormatMagickString( levels, MaxTextExtent, "%g,%g,%g",black_point,white_point,gamma);
-  (void) LevelImage( image(), levels );
-  throwImageException();
-}
-
-// Level image channel. Adjust the levels of the image channel by
-// scaling the values falling between specified white and black points
-// to the full available quantum range. The parameters provided
-// represent the black, mid (gamma), and white points.  The black
-// point specifies the darkest color in the image. Colors darker than
-// the black point are set to zero. Mid point (gamma) specifies a
-// gamma correction to apply to the image. White point specifies the
-// lightest color in the image.  Colors brighter than the white point
-// are set to the maximum quantum value. The black and white point
-// have the valid range 0 to QuantumRange while gamma has a useful range of
-// 0 to ten.
-void  Magick::Image::levelChannel ( const Magick::ChannelType channel,
-                                    const double black_point,
-                                    const double white_point,
-                                    const double gamma )
-{
-  modifyImage();
-  (void) LevelImageChannel( image(), channel, black_point, white_point,
-                            gamma );
-  throwImageException();
+  (void) LevelImage( image(), black_point, white_point, gamma, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Magnify image by integral size
@@ -1241,28 +1319,36 @@ void Magick::Image::magnify ( void )
 // Remap image colors with closest color from reference image
 void Magick::Image::map ( const Image &mapImage_ , const bool dither_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
   options()->quantizeDither( dither_ );
   RemapImage ( options()->quantizeInfo(), image(),
-             mapImage_.constImage());
-  throwImageException();
+             mapImage_.constImage(), &exceptionInfo);
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
-// Floodfill designated area with replacement opacity value
+// Floodfill designated area with replacement alpha value
 void Magick::Image::matteFloodfill ( const Color &target_ ,
-                                    const unsigned int opacity_,
-                                    const int x_, const int y_,
+                                    const unsigned int alpha_,
+                                    const ssize_t x_, const ssize_t y_,
                                     const Magick::PaintMethod method_ )
 {
   modifyImage();
-  MagickPixelPacket target;
-  GetMagickPixelPacket(constImage(),&target);
+  PixelInfo target;
+  GetPixelInfo(constImage(),&target);
   target.red=static_cast<PixelPacket>(target_).red;
   target.green=static_cast<PixelPacket>(target_).green;
   target.blue=static_cast<PixelPacket>(target_).blue;
-  target.opacity=opacity_;
-  FloodfillPaintImage ( image(), OpacityChannel, options()->drawInfo(), &target,
-    x_, y_, method_ == FloodfillMethod ? MagickFalse : MagickTrue);
-  throwImageException();
+  target.alpha=alpha_;
+  ChannelType channel_mask = SetPixelChannelMask( image(), AlphaChannel );
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  FloodfillPaintImage ( image(), options()->drawInfo(), &target, x_, y_,
+    method_ == FloodfillMethod ? MagickFalse : MagickTrue, &exceptionInfo);
+  (void) SetPixelChannelMap( image(), channel_mask );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Filter image by replacing each pixel component with the median
@@ -1272,7 +1358,8 @@ void Magick::Image::medianFilter ( const double radius_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    MedianFilterImage ( image(), radius_, &exceptionInfo );
+    StatisticImage ( image(), MedianStatistic, (size_t) radius_, (size_t)
+    radius_,&exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1296,12 +1383,15 @@ void Magick::Image::modulate ( const double brightness_,
                               const double hue_ )
 {
   char modulate[MaxTextExtent + 1];
-  FormatMagickString( modulate, MaxTextExtent, "%3.6f,%3.6f,%3.6f",
+  FormatLocaleString( modulate, MaxTextExtent, "%3.6f,%3.6f,%3.6f",
                brightness_, saturation_, hue_);
 
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  ModulateImage( image(), modulate );
-  throwImageException();
+  ModulateImage( image(), modulate, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Motion blur image with specified blur factor
@@ -1317,7 +1407,7 @@ void            Magick::Image::motionBlur ( const double radius_,
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    MotionBlurImage( image(), radius_, sigma_, angle_, &exceptionInfo);
+    MotionBlurImage( image(), radius_, sigma_, angle_, 0.0, &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1327,41 +1417,48 @@ void            Magick::Image::motionBlur ( const double radius_,
 // only
 void Magick::Image::negate ( const bool grayscale_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  NegateImage ( image(), grayscale_ == true ? MagickTrue : MagickFalse );
-  throwImageException();
+  NegateImage ( image(), grayscale_ == true ? MagickTrue : MagickFalse, 
+    &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Normalize image
 void Magick::Image::normalize ( void )
 {
   modifyImage();
-  NormalizeImage ( image() );
-  throwImageException();
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  NormalizeImage ( image(), &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Oilpaint image
-void Magick::Image::oilPaint ( const double radius_ )
+void Magick::Image::oilPaint ( const double radius_, const double sigma_ )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    OilPaintImage( image(), radius_, &exceptionInfo );
+    OilPaintImage( image(), radius_, sigma_, &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
-// Set or attenuate the opacity channel. If the image pixels are
-// opaque then they are set to the specified opacity value, otherwise
-// they are blended with the supplied opacity value.  The value of
-// opacity_ ranges from 0 (completely opaque) to QuantumRange. The defines
-// OpaqueOpacity and TransparentOpacity are available to specify
+// Set or attenuate the alpha channel. If the image pixels are
+// opaque then they are set to the specified alpha value, otherwise
+// they are blended with the supplied alpha value.  The value of
+// alpha_ ranges from 0 (completely opaque) to QuantumRange. The defines
+// OpaqueAlpha and TransparentAlpha are available to specify
 // completely opaque or completely transparent, respectively.
-void Magick::Image::opacity ( const unsigned int opacity_ )
+void Magick::Image::alpha ( const unsigned int alpha_ )
 {
   modifyImage();
-  SetImageOpacity( image(), opacity_ );
+  SetImageOpacity( image(), alpha_ );
 }
 
 // Change the color of an opaque pixel to the pen color.
@@ -1383,12 +1480,17 @@ void Magick::Image::opaque ( const Color &opaqueColor_,
   std::string opaqueColor = opaqueColor_;
   std::string penColor = penColor_;
 
-  MagickPixelPacket opaque;
-  MagickPixelPacket pen;
-  (void) QueryMagickColor(std::string(opaqueColor_).c_str(),&opaque,&image()->exception);
-  (void) QueryMagickColor(std::string(penColor_).c_str(),&pen,&image()->exception);
-  OpaquePaintImage ( image(), &opaque, &pen, MagickFalse );
-  throwImageException();
+  PixelInfo opaque;
+  PixelInfo pen;
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  (void) QueryMagickColorCompliance(std::string(opaqueColor_).c_str(),
+    AllCompliance, &opaque, &exceptionInfo);
+  (void) QueryMagickColorCompliance(std::string(penColor_).c_str(),
+    AllCompliance, &pen, &exceptionInfo);
+  OpaquePaintImage ( image(), &opaque, &pen, MagickFalse, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Ping is similar to read except only enough of the image is read to
@@ -1426,11 +1528,11 @@ void Magick::Image::ping ( const Blob& blob_ )
 // that accepted by a C 'main' routine. An exception is thrown if the
 // requested process module doesn't exist, fails to load, or fails during
 // execution.
-void Magick::Image::process( std::string name_, const int argc, const char **argv )
+void Magick::Image::process( std::string name_, const ssize_t argc, const char **argv )
 {
   modifyImage();
 
-  unsigned int status = 
+  size_t status = 
     InvokeDynamicImageFilter( name_.c_str(), &image(), argc, argv,
       &image()->exception );
 
@@ -1449,9 +1551,12 @@ void Magick::Image::quantize ( const bool measureError_  )
   else
     options()->quantizeInfo()->measure_error=MagickFalse;
 
-  QuantizeImage( options()->quantizeInfo(), image() );
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  QuantizeImage( options()->quantizeInfo(), image(), &exceptionInfo );
 
-  throwImageException();
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Apply an arithmetic or bitwise operator to the image pixel quantums.
@@ -1461,14 +1566,16 @@ void Magick::Image::quantumOperator ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  EvaluateImageChannel( image(), channel_, operator_, rvalue_, &exceptionInfo);
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
+  EvaluateImage( image(), operator_, rvalue_, &exceptionInfo);
+  (void) SetPixelChannelMap( image(), channel_mask );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
-void Magick::Image::quantumOperator ( const int x_,const int y_,
-                                      const unsigned int columns_,
-                                      const unsigned int rows_,
+void Magick::Image::quantumOperator ( const ssize_t x_,const ssize_t y_,
+                                      const size_t columns_,
+                                      const size_t rows_,
                                       const ChannelType channel_,
                                       const MagickEvaluateOperator operator_,
                                       const double rvalue_)
@@ -1482,8 +1589,9 @@ void Magick::Image::quantumOperator ( const int x_,const int y_,
   geometry.y = y_;
   MagickCore::Image *crop_image = CropImage( image(), &geometry,
     &exceptionInfo );
-  EvaluateImageChannel( crop_image, channel_, operator_, rvalue_,
-    &exceptionInfo );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
+  EvaluateImage( crop_image, operator_, rvalue_, &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   (void) CompositeImage( image(), image()->matte != MagickFalse ?
     OverCompositeOp : CopyCompositeOp, crop_image, geometry.x, geometry.y );
   crop_image = DestroyImageList(crop_image);
@@ -1496,10 +1604,13 @@ void Magick::Image::quantumOperator ( const int x_,const int y_,
 void Magick::Image::raise ( const Geometry &geometry_ ,
                            const bool raisedFlag_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   RectangleInfo raiseInfo = geometry_;
   modifyImage();
-  RaiseImage ( image(), &raiseInfo, raisedFlag_ == true ? MagickTrue : MagickFalse );
-  throwImageException();
+  RaiseImage ( image(), &raiseInfo, raisedFlag_ == true ? MagickTrue : MagickFalse, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 
@@ -1523,10 +1634,11 @@ void Magick::Image::randomThresholdChannel( const Geometry &thresholds_,
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  (void) RandomThresholdImageChannel( image(),
-                                      channel_,
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
+  (void) RandomThresholdImage( image(),
                                       static_cast<std::string>(thresholds_).c_str(),
                                       &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   throwImageException();
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
@@ -1595,7 +1707,7 @@ void  Magick::Image::read ( const Blob &blob_,
 // Read image of specified size and depth from in-memory BLOB
 void Magick::Image::read ( const Blob &blob_,
                           const Geometry &size_,
-                          const unsigned int depth_ )
+                          const size_t depth_ )
 {
   // Set image size
   size( size_ );
@@ -1608,7 +1720,7 @@ void Magick::Image::read ( const Blob &blob_,
 // Read image of specified size, depth, and format from in-memory BLOB
 void Magick::Image::read ( const Blob &blob_,
                           const Geometry &size_,
-                          const unsigned int depth_,
+                          const size_t depth_,
                           const std::string &magick_ )
 {
   // Set image size
@@ -1639,8 +1751,8 @@ void Magick::Image::read ( const Blob &blob_,
 }
 
 // Read image based on raw pixels in memory (ConstituteImage)
-void Magick::Image::read ( const unsigned int width_,
-                           const unsigned int height_,
+void Magick::Image::read ( const size_t width_,
+                           const size_t height_,
                            const std::string &map_,
                            const StorageType type_,
                            const void *pixels_ )
@@ -1657,27 +1769,14 @@ void Magick::Image::read ( const unsigned int width_,
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
-// Apply a color matrix to the image channels.  The user supplied
-// matrix may be of order 1 to 5 (1x1 through 5x5).
-void Magick::Image::recolor (const unsigned int order_,
-         const double *color_matrix_)
-{
-  ExceptionInfo exceptionInfo;
-  GetExceptionInfo( &exceptionInfo );
-  MagickCore::Image* newImage =
-    RecolorImage( image(), order_, color_matrix_, &exceptionInfo );
-  replaceImage( newImage );
-  throwException( exceptionInfo );
-  (void) DestroyExceptionInfo( &exceptionInfo );
-}
-
 // Reduce noise in image
 void Magick::Image::reduceNoise ( const double order_ )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    ReduceNoiseImage( image(), order_, &exceptionInfo );
+    StatisticImage( image(), NonpeakStatistic, (size_t) order_, (size_t) order_,
+    &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1688,10 +1787,10 @@ void Magick::Image::resize( const Geometry &geometry_ )
 {
   // Calculate new size.  This code should be supported using binary arguments
   // in the ImageMagick library.
-  long x = 0;
-  long y = 0;
-  unsigned long width = columns();
-  unsigned long height = rows();
+  ssize_t x = 0;
+  ssize_t y = 0;
+  size_t width = columns();
+  size_t height = rows();
 
   ParseMetaGeometry (static_cast<std::string>(geometry_).c_str(),
                      &x, &y,
@@ -1714,10 +1813,10 @@ void Magick::Image::resize( const Geometry &geometry_ )
 // Roll image
 void Magick::Image::roll ( const Geometry &roll_ )
 {
-  long xOff = roll_.xOff();
+  ssize_t xOff = roll_.xOff();
   if ( roll_.xNegative() )
     xOff = 0 - xOff;
-  long yOff = roll_.yOff();
+  ssize_t yOff = roll_.yOff();
   if ( roll_.yNegative() )
     yOff = 0 - yOff;
 
@@ -1729,15 +1828,15 @@ void Magick::Image::roll ( const Geometry &roll_ )
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
-void Magick::Image::roll ( const unsigned int columns_,
-                           const unsigned int rows_ )
+void Magick::Image::roll ( const size_t columns_,
+                           const size_t rows_ )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
     RollImage( image(),
-               static_cast<long>(columns_),
-               static_cast<long>(rows_), &exceptionInfo );
+               static_cast<ssize_t>(columns_),
+               static_cast<ssize_t>(rows_), &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1758,10 +1857,10 @@ void Magick::Image::rotate ( const double degrees_ )
 // Sample image
 void Magick::Image::sample ( const Geometry &geometry_ )
 {
-  long x = 0;
-  long y = 0;
-  unsigned long width = columns();
-  unsigned long height = rows();
+  ssize_t x = 0;
+  ssize_t y = 0;
+  size_t width = columns();
+  size_t height = rows();
 
   ParseMetaGeometry (static_cast<std::string>(geometry_).c_str(),
                      &x, &y,
@@ -1779,10 +1878,10 @@ void Magick::Image::sample ( const Geometry &geometry_ )
 // Scale image
 void Magick::Image::scale ( const Geometry &geometry_ )
 {
-  long x = 0;
-  long y = 0;
-  unsigned long width = columns();
-  unsigned long height = rows();
+  ssize_t x = 0;
+  ssize_t y = 0;
+  size_t width = columns();
+  size_t height = rows();
 
   ParseMetaGeometry (static_cast<std::string>(geometry_).c_str(),
                      &x, &y,
@@ -1803,15 +1902,17 @@ void Magick::Image::scale ( const Geometry &geometry_ )
 void Magick::Image::segment ( const double clusterThreshold_, 
                              const double smoothingThreshold_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
   SegmentImage ( image(),
                 options()->quantizeColorSpace(),
                 (MagickBooleanType) options()->verbose(),
                 clusterThreshold_,
-                smoothingThreshold_ );
-  throwImageException();
+                smoothingThreshold_, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
   SyncImage( image() );
-  throwImageException();
 }
 
 // Shade image using distant light source
@@ -1841,6 +1942,7 @@ void Magick::Image::sharpen ( const double radius_, const double sigma_ )
     SharpenImage( image(),
                   radius_,
                   sigma_,
+                  image()->bias,
                   &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
@@ -1852,12 +1954,14 @@ void Magick::Image::sharpenChannel ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
-    SharpenImageChannel( image(),
-                         channel_,
+    SharpenImage( image(),
                          radius_,
                          sigma_,
+                  image()->bias,
                          &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1895,20 +1999,26 @@ void Magick::Image::shear ( const double xShearAngle_,
 }
 
 // Contrast image
-void Magick::Image::sigmoidalContrast ( const unsigned int sharpen_, const double contrast, const double midpoint )
+void Magick::Image::sigmoidalContrast ( const size_t sharpen_, const double contrast, const double midpoint )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  (void) SigmoidalContrastImageChannel( image(), DefaultChannels, (MagickBooleanType) sharpen_, contrast, midpoint );
-  throwImageException();
+  (void) SigmoidalContrastImage( image(), (MagickBooleanType) sharpen_, contrast, midpoint, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Solarize image (similar to effect seen when exposing a photographic
 // film to light during the development process)
 void Magick::Image::solarize ( const double factor_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  SolarizeImage ( image(), factor_ );
-  throwImageException();
+  SolarizeImage ( image(), factor_, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Sparse color image, given a set of coordinates, interpolates the colors
@@ -1916,26 +2026,30 @@ void Magick::Image::solarize ( const double factor_ )
 //
 void Magick::Image::sparseColor ( const ChannelType channel,
                                   const SparseColorMethod method,
-                                  const unsigned long number_arguments,
+                                  const size_t number_arguments,
                                   const double *arguments )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  MagickCore::Image* newImage = SparseColorImage ( image(), channel, method,
+
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel );
+  MagickCore::Image* newImage = SparseColorImage ( image(), method,
     number_arguments, arguments, &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Spread pixels randomly within image by specified ammount
-void Magick::Image::spread ( const unsigned int amount_ )
+void Magick::Image::spread ( const size_t amount_ )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
     SpreadImage( image(),
                 amount_,
+                 image()->interpolate,
                 &exceptionInfo );
   replaceImage( newImage );
   throwException( exceptionInfo );
@@ -1976,7 +2090,7 @@ void Magick::Image::swirl ( const double degrees_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    SwirlImage( image(), degrees_,
+    SwirlImage( image(), degrees_, image()->interpolate,
                &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
@@ -2028,11 +2142,16 @@ void Magick::Image::transparent ( const Color &color_ )
 
   std::string color = color_;
 
-  MagickPixelPacket target;
-  (void) QueryMagickColor(std::string(color_).c_str(),&target,&image()->exception);
+  PixelInfo target;
+  (void) QueryMagickColorCompliance(std::string(color_).c_str(),AllCompliance,
+    &target,&image()->exception);
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  TransparentPaintImage ( image(), &target, TransparentOpacity, MagickFalse );
-  throwImageException();
+  TransparentPaintImage ( image(), &target, TransparentAlpha, MagickFalse,
+    &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Add matte image to image, setting pixels matching color to transparent
@@ -2048,16 +2167,19 @@ void Magick::Image::transparentChroma(const Color &colorLow_,
   std::string colorLow = colorLow_;
   std::string colorHigh = colorHigh_;
 
-  MagickPixelPacket targetLow;
-  MagickPixelPacket targetHigh;
-  (void) QueryMagickColor(std::string(colorLow_).c_str(),&targetLow,
-    &image()->exception);
-  (void) QueryMagickColor(std::string(colorHigh_).c_str(),&targetHigh,
-    &image()->exception);
+  PixelInfo targetLow;
+  PixelInfo targetHigh;
+  (void) QueryMagickColorCompliance(std::string(colorLow_).c_str(),
+    AllCompliance,&targetLow,&image()->exception);
+  (void) QueryMagickColorCompliance(std::string(colorHigh_).c_str(),
+    AllCompliance,&targetHigh,&image()->exception);
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
   TransparentPaintImageChroma ( image(), &targetLow, &targetHigh,
-    TransparentOpacity, MagickFalse );
-  throwImageException();
+    TransparentAlpha, MagickFalse, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 
@@ -2112,14 +2234,15 @@ void Magick::Image::unsharpmaskChannel ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
-    UnsharpMaskImageChannel( image(),
-                             channel_,
+    UnsharpMaskImage( image(),
                              radius_,
                              sigma_,
                              amount_,
                              threshold_,
                              &exceptionInfo );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -2134,6 +2257,7 @@ void Magick::Image::wave ( const double amplitude_, const double wavelength_ )
     WaveImage( image(),
               amplitude_,
               wavelength_,
+              image()->interpolate,
               &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
@@ -2143,10 +2267,13 @@ void Magick::Image::wave ( const double amplitude_, const double wavelength_ )
 // Write image to file
 void Magick::Image::write( const std::string &imageSpec_ )
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
   fileName( imageSpec_ );
-  WriteImage( imageInfo(), image() );
-  throwImageException();
+  WriteImage( imageInfo(), image(), &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Write image to in-memory BLOB
@@ -2184,7 +2311,7 @@ void Magick::Image::write ( Blob *blob_,
 }
 void Magick::Image::write ( Blob *blob_,
                            const std::string &magick_,
-                           const unsigned int depth_ )
+                           const size_t depth_ )
 {
   modifyImage();
   magick(magick_);
@@ -2205,10 +2332,10 @@ void Magick::Image::write ( Blob *blob_,
 // Write image to an array of pixels with storage type specified
 // by user (ExportImagePixels), e.g.
 // image.write( 0, 0, 640, 1, "RGB", 0, pixels );
-void Magick::Image::write ( const int x_,
-                            const int y_,
-                            const unsigned int columns_,
-                            const unsigned int rows_,
+void Magick::Image::write ( const ssize_t x_,
+                            const ssize_t y_,
+                            const size_t columns_,
+                            const size_t rows_,
                             const std::string &map_,
                             const StorageType type_,
                             void *pixels_ )
@@ -2227,10 +2354,10 @@ void Magick::Image::zoom( const Geometry &geometry_ )
 {
   // Calculate new size.  This code should be supported using binary arguments
   // in the ImageMagick library.
-  long x = 0;
-  long y = 0;
-  unsigned long width = columns();
-  unsigned long height = rows();
+  ssize_t x = 0;
+  ssize_t y = 0;
+  size_t width = columns();
+  size_t height = rows();
 
   ParseMetaGeometry (static_cast<std::string>(geometry_).c_str(),
                      &x, &y,
@@ -2239,9 +2366,11 @@ void Magick::Image::zoom( const Geometry &geometry_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   MagickCore::Image* newImage =
-    ZoomImage( image(),
+    ResizeImage( image(),
                width,
                height,
+               image()->filter,
+               image()->blur,
                &exceptionInfo);
   replaceImage( newImage );
   throwException( exceptionInfo );
@@ -2268,7 +2397,7 @@ bool Magick::Image::adjoin ( void ) const
 void Magick::Image::antiAlias( const bool flag_ )
 {
   modifyImage();
-  options()->antiAlias( static_cast<unsigned int>(flag_) );
+  options()->antiAlias( static_cast<size_t>(flag_) );
 }
 bool Magick::Image::antiAlias( void )
 {
@@ -2276,23 +2405,23 @@ bool Magick::Image::antiAlias( void )
 }
 
 // Animation inter-frame delay
-void Magick::Image::animationDelay ( const unsigned int delay_ )
+void Magick::Image::animationDelay ( const size_t delay_ )
 {
   modifyImage();
   image()->delay = delay_;
 }
-unsigned int Magick::Image::animationDelay ( void ) const
+size_t Magick::Image::animationDelay ( void ) const
 {
   return constImage()->delay;
 }
 
 // Number of iterations to play animation
-void Magick::Image::animationIterations ( const unsigned int iterations_ )
+void Magick::Image::animationIterations ( const size_t iterations_ )
 {
   modifyImage();
   image()->iterations = iterations_;
 }
-unsigned int Magick::Image::animationIterations ( void ) const
+size_t Magick::Image::animationIterations ( void ) const
 {
   return constImage()->iterations;
 }
@@ -2315,26 +2444,20 @@ std::string Magick::Image::attribute ( const std::string name_ )
 }
 
 // Background color
-void Magick::Image::backgroundColor ( const Color &color_ )
+void Magick::Image::backgroundColor ( const Color &backgroundColor_ )
 {
   modifyImage();
 
-  if ( color_.isValid() )
+  if ( backgroundColor_.isValid() )
     {
-      image()->background_color.red   = color_.redQuantum();
-      image()->background_color.green = color_.greenQuantum();
-      image()->background_color.blue  = color_.blueQuantum();
-      image()->background_color.opacity  = color_.alphaQuantum();
+      image()->background_color = backgroundColor_;
     }
   else
     {
-      image()->background_color.red   = 0;
-      image()->background_color.green = 0;
-      image()->background_color.blue  = 0;
-      image()->background_color.opacity  = OpaqueOpacity;
+      image()->background_color = Color();
     }
 
-  options()->backgroundColor( color_ );
+  options()->backgroundColor( backgroundColor_ );
 }
 Magick::Color Magick::Image::backgroundColor ( void ) const
 {
@@ -2353,7 +2476,7 @@ std::string Magick::Image::backgroundTexture ( void ) const
 }
 
 // Original image columns
-unsigned int Magick::Image::baseColumns ( void ) const
+size_t Magick::Image::baseColumns ( void ) const
 {
   return constImage()->magick_columns;
 }
@@ -2365,32 +2488,26 @@ std::string Magick::Image::baseFilename ( void ) const
 }
 
 // Original image rows
-unsigned int Magick::Image::baseRows ( void ) const
+size_t Magick::Image::baseRows ( void ) const
 {
   return constImage()->magick_rows;
 }
 
 // Border color
-void Magick::Image::borderColor ( const Color &color_ )
+void Magick::Image::borderColor ( const Color &borderColor_ )
 {
   modifyImage();
 
-  if ( color_.isValid() )
+  if ( borderColor_.isValid() )
     {
-      image()->border_color.red   = color_.redQuantum();
-      image()->border_color.green = color_.greenQuantum();
-      image()->border_color.blue  = color_.blueQuantum();
-      image()->border_color.opacity  = color_.alphaQuantum();
+      image()->border_color = borderColor_;
     }
   else
     {
-      image()->border_color.red   = 0;
-      image()->border_color.green = 0;
-      image()->border_color.blue  = 0;
-      image()->border_color.opacity = OpaqueOpacity;
+      image()->border_color = Color();
     }
 
-  options()->borderColor( color_ );
+  options()->borderColor( borderColor_ );
 }
 Magick::Color Magick::Image::borderColor ( void ) const
 {
@@ -2425,7 +2542,7 @@ Magick::Color Magick::Image::boxColor ( void ) const
 // subsequent pixels cache operations are to/from disk.
 // This setting is shared by all Image objects.
 /* static */
-void Magick::Image::cacheThreshold ( const unsigned int threshold_ )
+void Magick::Image::cacheThreshold ( const size_t threshold_ )
 {
   SetMagickResourceLimit( MemoryResource, threshold_ );
 }
@@ -2497,7 +2614,7 @@ void Magick::Image::classType ( const ClassType class_ )
     {
       // Quantize to create PseudoClass color map
       modifyImage();
-      quantizeColors((unsigned long) QuantumRange + 1);
+      quantizeColors(MaxColormapSize);
       quantize();
       image()->storage_class = static_cast<MagickCore::ClassType>(PseudoClass);
     }
@@ -2510,26 +2627,30 @@ void Magick::Image::clipMask ( const Magick::Image & clipMask_ )
 {
   modifyImage();
 
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   if( clipMask_.isValid() )
     {
       // Set clip mask
-      SetImageClipMask( image(), clipMask_.constImage() );
+      SetImageClipMask( image(), clipMask_.constImage(), &exceptionInfo );
     }
   else
     {
       // Unset existing clip mask
-      SetImageClipMask( image(), 0 );
+      SetImageClipMask( image(), 0, &exceptionInfo );
     }
+   throwException( exceptionInfo );
+   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 Magick::Image Magick::Image::clipMask ( void  ) const
 {
-      ExceptionInfo exceptionInfo;
-      GetExceptionInfo( &exceptionInfo );
-      MagickCore::Image* image =
-        GetImageClipMask( constImage(), &exceptionInfo );
-      throwException( exceptionInfo );
-  (void) DestroyExceptionInfo( &exceptionInfo );
-      return Magick::Image( image );
+   ExceptionInfo exceptionInfo;
+   GetExceptionInfo( &exceptionInfo );
+   MagickCore::Image* image =
+     GetImageClipMask( constImage(), &exceptionInfo );
+   throwException( exceptionInfo );
+   (void) DestroyExceptionInfo( &exceptionInfo );
+   return Magick::Image( image );
 }
 
 void Magick::Image::colorFuzz ( const double fuzz_ )
@@ -2544,7 +2665,7 @@ double Magick::Image::colorFuzz ( void ) const
 }
 
 // Set color in colormap at index
-void Magick::Image::colorMap ( const unsigned int index_,
+void Magick::Image::colorMap ( const size_t index_,
                               const Color &color_ )
 {
   MagickCore::Image* imageptr = image();
@@ -2566,7 +2687,7 @@ void Magick::Image::colorMap ( const unsigned int index_,
   (imageptr->colormap)[index_] = color_;
 }
 // Return color in colormap at index
-Magick::Color Magick::Image::colorMap ( const unsigned int index_ ) const
+Magick::Color Magick::Image::colorMap ( const size_t index_ ) const
 {
   const MagickCore::Image* imageptr = constImage();
 
@@ -2582,7 +2703,7 @@ Magick::Color Magick::Image::colorMap ( const unsigned int index_ ) const
 }
 
 // Colormap size (number of colormap entries)
-void Magick::Image::colorMapSize ( const unsigned int entries_ )
+void Magick::Image::colorMapSize ( const size_t entries_ )
 {
   if (entries_ >MaxColormapSize )
     throwExceptionExplicit( OptionError,
@@ -2608,12 +2729,12 @@ void Magick::Image::colorMapSize ( const unsigned int entries_ )
 
   // Initialize any new colormap entries as all black
   Color black(0,0,0);
-  for( unsigned int i=imageptr->colors; i<(entries_-1); i++ )
+  for( size_t i=imageptr->colors; i<(entries_-1); i++ )
     (imageptr->colormap)[i] = black;
 
   imageptr->colors = entries_;
 }
-unsigned int Magick::Image::colorMapSize ( void )
+size_t Magick::Image::colorMapSize ( void )
 {
   const MagickCore::Image* imageptr = constImage();
 
@@ -2634,10 +2755,12 @@ void Magick::Image::colorSpace( const ColorspaceType colorSpace_ )
   modifyImage();
 
   if ( colorSpace_ != RGBColorspace &&
+       colorSpace_ != sRGBColorspace &&
        colorSpace_ != TransparentColorspace &&
        colorSpace_ != GRAYColorspace )
     {
       if (image()->colorspace != RGBColorspace &&
+          image()->colorspace != sRGBColorspace &&
           image()->colorspace != TransparentColorspace &&
           image()->colorspace != GRAYColorspace)
         {
@@ -2652,6 +2775,7 @@ void Magick::Image::colorSpace( const ColorspaceType colorSpace_ )
     }
 
   if ( colorSpace_ == RGBColorspace ||
+       colorSpace_ == sRGBColorspace ||
        colorSpace_ == TransparentColorspace ||
        colorSpace_ == GRAYColorspace )
     {
@@ -2816,14 +2940,14 @@ Magick::Geometry Magick::Image::density ( void ) const
 {
   if (isValid())
     {
-      unsigned int x_resolution=72;
-      unsigned int y_resolution=72;
+      ssize_t x_resolution=72;
+      ssize_t y_resolution=72;
 
       if (constImage()->x_resolution > 0.0)
-        x_resolution=static_cast<unsigned int>(constImage()->x_resolution + 0.5);
+        x_resolution=static_cast<ssize_t>(constImage()->x_resolution + 0.5);
 
       if (constImage()->y_resolution > 0.0)
-        y_resolution=static_cast<unsigned int>(constImage()->y_resolution + 0.5);
+        y_resolution=static_cast<ssize_t>(constImage()->y_resolution + 0.5);
 
       return Geometry(x_resolution,y_resolution);
     }
@@ -2832,9 +2956,9 @@ Magick::Geometry Magick::Image::density ( void ) const
 }
 
 // Image depth (bits allocated to red/green/blue components)
-void Magick::Image::depth ( const unsigned int depth_ )
+void Magick::Image::depth ( const size_t depth_ )
 {
-  unsigned int depth = depth_;
+  size_t depth = depth_;
 
   if (depth > MAGICKCORE_QUANTUM_DEPTH)
     depth=MAGICKCORE_QUANTUM_DEPTH;
@@ -2843,7 +2967,7 @@ void Magick::Image::depth ( const unsigned int depth_ )
   image()->depth=depth;
   options()->depth( depth );
 }
-unsigned int Magick::Image::depth ( void ) const
+size_t Magick::Image::depth ( void ) const
 {
   return constImage()->depth;
 }
@@ -3009,8 +3133,12 @@ void Magick::Image::fontTypeMetrics( const std::string &text_,
 {
   DrawInfo *drawInfo = options()->drawInfo();
   drawInfo->text = const_cast<char *>(text_.c_str());
-  GetTypeMetrics( image(), drawInfo, &(metrics->_typeMetric) );
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  GetTypeMetrics( image(), drawInfo, &(metrics->_typeMetric), &exceptionInfo );
   drawInfo->text = 0;
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 // Image format string
@@ -3051,12 +3179,12 @@ Magick::Geometry Magick::Image::geometry ( void ) const
   return Geometry();
 }
 
-void Magick::Image::gifDisposeMethod ( const unsigned int disposeMethod_ )
+void Magick::Image::gifDisposeMethod ( const size_t disposeMethod_ )
 {
   modifyImage();
   image()->dispose = (DisposeType) disposeMethod_;
 }
-unsigned int Magick::Image::gifDisposeMethod ( void ) const
+size_t Magick::Image::gifDisposeMethod ( void ) const
 {
   // FIXME: It would be better to return an enumeration
   return constImage()->dispose;
@@ -3178,7 +3306,7 @@ void Magick::Image::matte ( const bool matteFlag_ )
   // desired, then set the matte channel to opaque.
   if ((matteFlag_ && !constImage()->matte) ||
       (constImage()->matte && !matteFlag_))
-    SetImageOpacity(image(),OpaqueOpacity);
+    SetImageOpacity(image(),OpaqueAlpha);
 
   image()->matte = (MagickBooleanType) matteFlag_;
 }
@@ -3196,22 +3324,14 @@ void Magick::Image::matteColor ( const Color &matteColor_ )
   
   if ( matteColor_.isValid() )
     {
-      image()->matte_color.red   = matteColor_.redQuantum();
-      image()->matte_color.green = matteColor_.greenQuantum();
-      image()->matte_color.blue  = matteColor_.blueQuantum();
-      image()->matte_color.opacity  = matteColor_.alphaQuantum();
-
-      options()->matteColor( matteColor_ ); 
+      image()->matte_color = matteColor_;
+      options()->matteColor( matteColor_ );
     }
   else
     {
       // Set to default matte color
       Color tmpColor( "#BDBDBD" );
-      image()->matte_color.red   = tmpColor.redQuantum();
-      image()->matte_color.green = tmpColor.greenQuantum();
-      image()->matte_color.blue  = tmpColor.blueQuantum();
-      image()->matte_color.opacity  = tmpColor.alphaQuantum();
-
+      image()->matte_color = tmpColor;
       options()->matteColor( tmpColor );
     }
 }
@@ -3219,8 +3339,7 @@ Magick::Color Magick::Image::matteColor ( void ) const
 {
   return Color( constImage()->matte_color.red,
                constImage()->matte_color.green,
-               constImage()->matte_color.blue,
-               constImage()->matte_color.opacity );
+               constImage()->matte_color.blue );
 }
 
 double Magick::Image::meanErrorPerPixel ( void ) const
@@ -3230,17 +3349,17 @@ double Magick::Image::meanErrorPerPixel ( void ) const
 
 // Image modulus depth (minimum number of bits required to support
 // red/green/blue components without loss of accuracy)
-void Magick::Image::modulusDepth ( const unsigned int depth_ )
+void Magick::Image::modulusDepth ( const size_t depth_ )
 {
   modifyImage();
   SetImageDepth( image(), depth_ );
   options()->depth( depth_ );
 }
-unsigned int Magick::Image::modulusDepth ( void ) const
+size_t Magick::Image::modulusDepth ( void ) const
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  unsigned int depth=GetImageDepth( constImage(), &exceptionInfo );
+  size_t depth=GetImageDepth( constImage(), &exceptionInfo );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
   return depth;
@@ -3333,11 +3452,11 @@ Magick::Image  Magick::Image::penTexture ( void  ) const
 }
 
 // Set the color of a pixel.
-void Magick::Image::pixelColor ( const unsigned int x_, const unsigned int y_,
+void Magick::Image::pixelColor ( const ssize_t x_, const ssize_t y_,
                                 const Color &color_ )
 {
   // Test arguments to ensure they are within the image.
-  if ( y_ > rows() || x_ > columns() )
+  if ( y_ > (ssize_t) rows() || x_ > (ssize_t) columns() )
     throwExceptionExplicit( OptionError,
            "Access outside of image boundary" );
       
@@ -3349,7 +3468,9 @@ void Magick::Image::pixelColor ( const unsigned int x_, const unsigned int y_,
   // Get pixel view
   Pixels pixels(*this);
     // Set pixel value
-  *(pixels.get(x_, y_, 1, 1 )) = color_;
+  Quantum *pixel = pixels.get(x_, y_, 1, 1 );
+  PixelPacket packet = color_;
+  MagickCore::SetPixelPacket(constImage(),&packet,pixel);
   // Tell ImageMagick that pixels have been updated
   pixels.sync();
 
@@ -3357,25 +3478,18 @@ void Magick::Image::pixelColor ( const unsigned int x_, const unsigned int y_,
 }
 
 // Get the color of a pixel
-Magick::Color Magick::Image::pixelColor ( const unsigned int x_,
-                                         const unsigned int y_ ) const
+Magick::Color Magick::Image::pixelColor ( const ssize_t x_,
+                                         const ssize_t y_ ) const
 {
   ClassType storage_class;
   storage_class = classType();
   // DirectClass
-  const PixelPacket* pixel = getConstPixels( x_, y_, 1, 1 );
-  if ( storage_class == DirectClass )
+  const Quantum* pixel = getConstPixels( x_, y_, 1, 1 );
+  if ( pixel )
     {
-      if ( pixel )
-        return Color( *pixel );
-    }
-
-  // PseudoClass
-  if ( storage_class == PseudoClass )
-    {
-      const IndexPacket* indexes = getConstIndexes();
-      if ( indexes )
-        return colorMap( (unsigned long) *indexes );
+      PixelPacket packet;
+      MagickCore::GetPixelPacket(constImage(),pixel,&packet);
+      return Color( packet );
     }
 
   return Color(); // invalid
@@ -3406,7 +3520,7 @@ void Magick::Image::profile( const std::string name_,
                              const Magick::Blob &profile_ )
 {
   modifyImage();
-  int result = ProfileImage( image(), name_.c_str(),
+  ssize_t result = ProfileImage( image(), name_.c_str(),
                              (unsigned char *)profile_.data(),
                              profile_.length(), MagickTrue);
 
@@ -3433,23 +3547,23 @@ Magick::Blob Magick::Image::profile( const std::string name_ ) const
   return blob;
 }
 
-void Magick::Image::quality ( const unsigned int quality_ )
+void Magick::Image::quality ( const size_t quality_ )
 {
   modifyImage();
   image()->quality = quality_;
   options()->quality( quality_ );
 }
-unsigned int Magick::Image::quality ( void ) const
+size_t Magick::Image::quality ( void ) const
 {
   return constImage()->quality;
 }
 
-void Magick::Image::quantizeColors ( const unsigned int colors_ )
+void Magick::Image::quantizeColors ( const size_t colors_ )
 {
   modifyImage();
   options()->quantizeColors( colors_ );
 }
-unsigned int Magick::Image::quantizeColors ( void ) const
+size_t Magick::Image::quantizeColors ( void ) const
 {
   return constOptions()->quantizeColors( );
 }
@@ -3475,12 +3589,12 @@ bool Magick::Image::quantizeDither ( void ) const
   return constOptions()->quantizeDither( );
 }
 
-void Magick::Image::quantizeTreeDepth ( const unsigned int treeDepth_ )
+void Magick::Image::quantizeTreeDepth ( const size_t treeDepth_ )
 {
   modifyImage();
   options()->quantizeTreeDepth( treeDepth_ );
 }
-unsigned int Magick::Image::quantizeTreeDepth ( void ) const
+size_t Magick::Image::quantizeTreeDepth ( void ) const
 {
   return constOptions()->quantizeTreeDepth( );
 }
@@ -3508,12 +3622,12 @@ Magick::ResolutionType Magick::Image::resolutionUnits ( void ) const
   return constOptions()->resolutionUnits( );
 }
 
-void Magick::Image::scene ( const unsigned int scene_ )
+void Magick::Image::scene ( const size_t scene_ )
 {
   modifyImage();
   image()->scene = scene_;
 }
-unsigned int Magick::Image::scene ( void ) const
+size_t Magick::Image::scene ( void ) const
 {
   return constImage()->scene;
 }
@@ -3523,13 +3637,17 @@ std::string Magick::Image::signature ( const bool force_ ) const
   Lock( &_imgRef->_mutexLock );
 
   // Re-calculate image signature if necessary
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   if ( force_ ||
        !GetImageProperty(constImage(), "Signature") ||
        constImage()->taint )
     {
-      SignatureImage( const_cast<MagickCore::Image *>(constImage()) );
+      SignatureImage( const_cast<MagickCore::Image *>(constImage()), &exceptionInfo );
     }
 
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
   const char *property = GetImageProperty(constImage(), "Signature");
 
   return std::string( property );
@@ -3563,7 +3681,7 @@ void Magick::Image::splice( const Geometry &geometry_ )
 // Obtain image statistics. Statistics are normalized to the range of
 // 0.0 to 1.0 and are output to the specified ImageStatistics
 // structure.
-void Magick::Image::statistics ( ImageStatistics *statistics ) const
+void Magick::Image::statistics ( ImageStatistics *statistics ) 
 {
   double
     maximum,
@@ -3571,44 +3689,59 @@ void Magick::Image::statistics ( ImageStatistics *statistics ) const
 
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  (void) GetImageChannelRange(constImage(),RedChannel,&minimum,&maximum,
-    &exceptionInfo);
+
+  ChannelType channel_mask = SetPixelChannelMask( image(), RedChannel);
+  (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
   statistics->red.minimum=minimum;
-       statistics->red.maximum=maximum;
-  (void) GetImageChannelMean(constImage(),RedChannel,
-    &statistics->red.mean,&statistics->red.standard_deviation,&exceptionInfo);
-  (void) GetImageChannelKurtosis(constImage(),RedChannel,
-    &statistics->red.kurtosis,&statistics->red.skewness,&exceptionInfo);
-  (void) GetImageChannelRange(constImage(),GreenChannel,&minimum,&maximum,
-    &exceptionInfo);
+  statistics->red.maximum=maximum;
+  (void) GetImageMean( image(),&statistics->red.mean,
+    &statistics->red.standard_deviation,&exceptionInfo);
+  (void) GetImageKurtosis( image(),&statistics->red.kurtosis,
+    &statistics->red.skewness,&exceptionInfo);
+  (void) SetPixelChannelMap( image(), channel_mask );
+
+  channel_mask = SetPixelChannelMask( image(), GreenChannel);
+  (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
   statistics->green.minimum=minimum;
-       statistics->green.maximum=maximum;
-  (void) GetImageChannelMean(constImage(),GreenChannel,
-    &statistics->green.mean,&statistics->green.standard_deviation,
-    &exceptionInfo);
-  (void) GetImageChannelKurtosis(constImage(),GreenChannel,
-    &statistics->green.kurtosis,&statistics->green.skewness,&exceptionInfo);
-  (void) GetImageChannelRange(constImage(),BlueChannel,&minimum,&maximum,
-    &exceptionInfo);
+  statistics->green.maximum=maximum;
+  (void) GetImageMean( image(),&statistics->green.mean,
+    &statistics->green.standard_deviation,&exceptionInfo);
+  (void) GetImageKurtosis( image(),&statistics->green.kurtosis,
+    &statistics->green.skewness,&exceptionInfo);
+  (void) SetPixelChannelMap( image(), channel_mask );
+
+  channel_mask = SetPixelChannelMask( image(), GreenChannel);
+  (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
   statistics->blue.minimum=minimum;
-       statistics->blue.maximum=maximum;
-  (void) GetImageChannelMean(constImage(),BlueChannel,
-    &statistics->blue.mean,&statistics->blue.standard_deviation,&exceptionInfo);
-  (void) GetImageChannelKurtosis(constImage(),BlueChannel,
-    &statistics->blue.kurtosis,&statistics->blue.skewness,&exceptionInfo);
-  (void) GetImageChannelRange(constImage(),OpacityChannel,&minimum,&maximum,
-    &exceptionInfo);
-  statistics->opacity.minimum=minimum;
-       statistics->opacity.maximum=maximum;
-  (void) GetImageChannelMean(constImage(),OpacityChannel,
-    &statistics->opacity.mean,&statistics->opacity.standard_deviation,
-    &exceptionInfo);
-  (void) GetImageChannelKurtosis(constImage(),OpacityChannel,
-    &statistics->opacity.kurtosis,&statistics->opacity.skewness,&exceptionInfo);
+  statistics->blue.maximum=maximum;
+  (void) GetImageMean( image(),&statistics->blue.mean,
+    &statistics->blue.standard_deviation,&exceptionInfo);
+  (void) GetImageKurtosis( image(),&statistics->blue.kurtosis,
+    &statistics->blue.skewness,&exceptionInfo);
+  (void) SetPixelChannelMap( image(), channel_mask );
+
+  channel_mask = SetPixelChannelMask( image(), AlphaChannel);
+  (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
+  statistics->alpha.minimum=minimum;
+  statistics->alpha.maximum=maximum;
+  (void) GetImageMean( image(),&statistics->alpha.mean,
+    &statistics->alpha.standard_deviation,&exceptionInfo);
+  (void) GetImageKurtosis( image(),&statistics->alpha.kurtosis,
+    &statistics->alpha.skewness,&exceptionInfo);
+  (void) SetPixelChannelMap( image(), channel_mask );
+
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
+// Strip strips an image of all profiles and comments.
+void Magick::Image::strip ( void )
+{
+  modifyImage();
+  StripImage( image() );
+  throwImageException();
+}
+
 // enabled/disable stroke anti-aliasing
 void Magick::Image::strokeAntiAlias ( const bool flag_ )
 {
@@ -3687,12 +3820,12 @@ Magick::LineJoin Magick::Image::strokeLineJoin ( void ) const
 // stroking the path. The miterLimit' imposes a limit on the ratio of
 // the miter length to the 'lineWidth'. The default value of this
 // parameter is 4.
-void Magick::Image::strokeMiterLimit ( const unsigned int strokeMiterLimit_ )
+void Magick::Image::strokeMiterLimit ( const size_t strokeMiterLimit_ )
 {
   modifyImage();
   options()->strokeMiterLimit( strokeMiterLimit_ );
 }
-unsigned int Magick::Image::strokeMiterLimit ( void ) const
+size_t Magick::Image::strokeMiterLimit ( void ) const
 {
   return constOptions()->strokeMiterLimit( );
 }
@@ -3741,22 +3874,22 @@ double Magick::Image::strokeWidth ( void ) const
   return constOptions()->strokeWidth( );
 }
 
-void Magick::Image::subImage ( const unsigned int subImage_ )
+void Magick::Image::subImage ( const size_t subImage_ )
 {
   modifyImage();
   options()->subImage( subImage_ );
 }
-unsigned int Magick::Image::subImage ( void ) const
+size_t Magick::Image::subImage ( void ) const
 {
   return constOptions()->subImage( );
 }
 
-void Magick::Image::subRange ( const unsigned int subRange_ )
+void Magick::Image::subRange ( const size_t subRange_ )
 {
   modifyImage();
   options()->subRange( subRange_ );
 }
-unsigned int Magick::Image::subRange ( void ) const
+size_t Magick::Image::subRange ( void ) const
 {
   return constOptions()->subRange( );
 }
@@ -3772,21 +3905,11 @@ std::string Magick::Image::textEncoding ( void ) const
   return constOptions()->textEncoding( );
 }
 
-void Magick::Image::tileName ( const std::string &tileName_ )
-{
-  modifyImage();
-  options()->tileName( tileName_ );
-}
-std::string Magick::Image::tileName ( void ) const
-{
-  return constOptions()->tileName( );
-}
-
-unsigned long Magick::Image::totalColors ( void )
+size_t Magick::Image::totalColors ( void )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  unsigned long colors = GetNumberColors( image(), 0, &exceptionInfo);
+  size_t colors = GetNumberColors( image(), 0, &exceptionInfo);
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
   return colors;
@@ -3849,9 +3972,13 @@ Magick::ImageType Magick::Image::type ( void ) const
 }
 void Magick::Image::type ( const Magick::ImageType type_)
 {
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
   modifyImage();
   options()->type( type_ );
-  SetImageType( image(), type_ );
+  SetImageType( image(), type_, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
 void Magick::Image::verbose ( const bool verboseFlag_ )
@@ -3957,14 +4084,14 @@ Magick::Image& Magick::Image::operator=( const Magick::Image &image_ )
 
 // Transfers read-only pixels from the image to the pixel cache as
 // defined by the specified region
-const Magick::PixelPacket* Magick::Image::getConstPixels
-  ( const int x_, const int y_,
-    const unsigned int columns_,
-    const unsigned int rows_ ) const
+const Magick::Quantum* Magick::Image::getConstPixels
+  ( const ssize_t x_, const ssize_t y_,
+    const size_t columns_,
+    const size_t rows_ ) const
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  const PixelPacket* p = (*GetVirtualPixels)( constImage(),
+  const Quantum* p = (*GetVirtualPixels)( constImage(),
                                                 x_, y_,
                                                 columns_, rows_,
                                                 &exceptionInfo );
@@ -3973,10 +4100,10 @@ const Magick::PixelPacket* Magick::Image::getConstPixels
   return p;
 }
 
-// Obtain read-only pixel indexes (valid for PseudoClass images)
-const Magick::IndexPacket* Magick::Image::getConstIndexes ( void ) const
+// Obtain read-only pixel associated pixels channels
+const void* Magick::Image::getConstMetacontent ( void ) const
 {
-  const Magick::IndexPacket* result = GetVirtualIndexQueue( constImage() );
+  const void* result = GetVirtualMetacontent( constImage() );
 
   if( !result )
     throwImageException();
@@ -3984,10 +4111,10 @@ const Magick::IndexPacket* Magick::Image::getConstIndexes ( void ) const
   return result;
 }
 
-// Obtain image pixel indexes (valid for PseudoClass images)
-Magick::IndexPacket* Magick::Image::getIndexes ( void )
+// Obtain image pixel associated pixels channels
+void* Magick::Image::getMetacontent ( void )
 {
-  Magick::IndexPacket* result = GetAuthenticIndexQueue( image() );
+  void* result = GetAuthenticMetacontent( image() );
 
   if( !result )
     throwImageException();
@@ -3998,14 +4125,14 @@ Magick::IndexPacket* Magick::Image::getIndexes ( void )
 // Transfers pixels from the image to the pixel cache as defined
 // by the specified region. Modified pixels may be subsequently
 // transferred back to the image via syncPixels.
-Magick::PixelPacket* Magick::Image::getPixels ( const int x_, const int y_,
-                                               const unsigned int columns_,
-                                               const unsigned int rows_ )
+Magick::Quantum* Magick::Image::getPixels ( const ssize_t x_, const ssize_t y_,
+                                               const size_t columns_,
+                                               const size_t rows_ )
 {
   modifyImage();
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PixelPacket* result = (*GetAuthenticPixels)( image(),
+  Quantum* result = (*GetAuthenticPixels)( image(),
                                            x_, y_,
                                            columns_, rows_, &exceptionInfo );
   throwException( exceptionInfo );
@@ -4017,14 +4144,14 @@ Magick::PixelPacket* Magick::Image::getPixels ( const int x_, const int y_,
 // Allocates a pixel cache region to store image pixels as defined
 // by the region rectangle.  This area is subsequently transferred
 // from the pixel cache to the image via syncPixels.
-Magick::PixelPacket* Magick::Image::setPixels ( const int x_, const int y_,
-                                               const unsigned int columns_,
-                                               const unsigned int rows_ )
+Magick::Quantum* Magick::Image::setPixels ( const ssize_t x_, const ssize_t y_,
+                                               const size_t columns_,
+                                               const size_t rows_ )
 {
   modifyImage();
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PixelPacket* result = (*QueueAuthenticPixels)( image(),
+  Quantum* result = (*QueueAuthenticPixels)( image(),
                                            x_, y_,
                                            columns_, rows_, &exceptionInfo );
   throwException( exceptionInfo );
@@ -4147,7 +4274,13 @@ MagickCore::Image * Magick::Image::replaceImage
   if( replacement_ )
     image = replacement_;
   else
-    image = AcquireImage(constImageInfo());
+    {
+      ExceptionInfo exceptionInfo;
+      GetExceptionInfo( &exceptionInfo );
+      image = AcquireImage(constImageInfo(), &exceptionInfo);
+      throwException( exceptionInfo );
+      (void) DestroyExceptionInfo( &exceptionInfo );
+    }
 
   {
     Lock( &_imgRef->_mutexLock );
@@ -4209,7 +4342,7 @@ void Magick::Image::throwImageException( void ) const
 }
 
 // Register image with image registry or obtain registration id
-long Magick::Image::registerId( void )
+ssize_t Magick::Image::registerId( void )
 {
   Lock( &_imgRef->_mutexLock );
   if( _imgRef->id() < 0 )
@@ -4218,7 +4351,7 @@ long Magick::Image::registerId( void )
       ExceptionInfo exceptionInfo;
       GetExceptionInfo( &exceptionInfo );
       _imgRef->id(_imgRef->id()+1);
-      sprintf(id,"%ld\n",_imgRef->id());
+      sprintf(id,"%.20g\n",(double) _imgRef->id());
       SetImageRegistry(ImageRegistryType, id, image(), &exceptionInfo);
       throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -4253,7 +4386,7 @@ void Magick::MagickPlusPlusDestroyMagick(void)
 }
 
 // C library initialization routine
-void MagickDLLDecl Magick::InitializeMagick(const char *path_)
+void MagickPPExport Magick::InitializeMagick(const char *path_)
 {
   MagickCore::MagickCoreGenesis(path_,MagickFalse);
   if (!magick_initialized)