Fixed opening and saving file in IMDisplay.
diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp
index 6f89163..2b5f798 100644
--- a/Magick++/lib/Image.cpp
+++ b/Magick++/lib/Image.cpp
@@ -3193,6 +3193,11 @@
   SetMagickResourceLimit( MemoryResource, threshold_ );
 }
 
+size_t Magick::Image::channels() const
+{
+  return constImage()->number_channels;
+}
+
 void Magick::Image::chromaBluePrimary ( const double x_, const double y_ )
 {
   modifyImage();
diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h
index 98a8a8b..9e1f3cf 100644
--- a/Magick++/lib/Magick++/Image.h
+++ b/Magick++/lib/Magick++/Image.h
@@ -989,7 +989,10 @@
     // is exceeded, all subsequent pixels cache operations are to/from
     // disk.  This setting is shared by all Image objects.
     static void     cacheThreshold ( const MagickSizeType threshold_ );
-    
+
+    // Returns the number of channels in this image.
+    size_t channels() const;
+
     // Chromaticity blue primary point (e.g. x=0.15, y=0.06)
     void            chromaBluePrimary ( const double x_, const double y_ );
     void            chromaBluePrimary ( double *x_, double *y_ ) const;
diff --git a/Magick++/lib/Magick++/Pixels.h b/Magick++/lib/Magick++/Pixels.h
index 8d0a1d4..93ce3c0 100644
--- a/Magick++/lib/Magick++/Pixels.h
+++ b/Magick++/lib/Magick++/Pixels.h
@@ -23,25 +23,28 @@
 
     // Destroy pixel view
     ~Pixels(void);
-    
+
     // Transfer pixels from the image to the pixel view as defined by
     // the specified region. Modified pixels may be subsequently
     // transferred back to the image via sync.
-    Quantum* get(const ::ssize_t x_,const ::ssize_t y_,
+    Quantum *get(const ::ssize_t x_,const ::ssize_t y_,
       const size_t columns_,const size_t rows_);
 
     // Transfer read-only pixels from the image to the pixel view as
     // defined by the specified region.
-    const Quantum* getConst(const ::ssize_t x_,const ::ssize_t y_,
+    const Quantum *getConst(const ::ssize_t x_,const ::ssize_t y_,
       const size_t columns_,const size_t rows_);
 
     // Return pixel colormap index array
-    //Quantum* metacontent(void);
+    //Quantum *metacontent(void);
+
+    // Returns the offset for the specified channel.
+    ssize_t offset(PixelChannel channel) const;
 
     // Allocate a pixel view region to store image pixels as defined
     // by the region rectangle.  This area is subsequently transferred
     // from the pixel view to the image via sync.
-    Quantum* set(const ::ssize_t x_,const ::ssize_t y_,const size_t columns_,
+    Quantum *set(const ::ssize_t x_,const ::ssize_t y_,const size_t columns_,
       const size_t rows_ );
 
     // Transfers the image view pixels to the image.
@@ -66,7 +69,7 @@
     const Pixels& operator=(const Pixels& pixels_);
 
     Magick::Image             _image;     // Image reference
-    MagickCore::CacheView*    _view;      // Image view handle
+    MagickCore::CacheView     *_view;     // Image view handle
     ::ssize_t                 _x;         // Left ordinate of view
     ::ssize_t                 _y;         // Top ordinate of view
     size_t                    _columns;   // Width of view
diff --git a/Magick++/lib/Pixels.cpp b/Magick++/lib/Pixels.cpp
index 6677dc6..f42ad6d 100644
--- a/Magick++/lib/Pixels.cpp
+++ b/Magick++/lib/Pixels.cpp
@@ -71,6 +71,13 @@
   return pixels;
 }
 
+ssize_t Magick::Pixels::offset(PixelChannel channel) const
+{
+  if (_image.constImage()->channel_map[channel].traits == UndefinedPixelTrait)
+    return -1;
+  return _image.constImage()->channel_map[channel].offset;
+}
+
 Magick::Quantum* Magick::Pixels::set(const ssize_t x_,const ssize_t y_,
   const size_t columns_,const size_t rows_)
 {