diff --git a/MagickCore/xwindow.c b/MagickCore/xwindow.c
index edb4f61..7db9ac3 100644
--- a/MagickCore/xwindow.c
+++ b/MagickCore/xwindow.c
@@ -6129,9 +6129,6 @@
           register unsigned int
             bytes_per_pixel;
 
-          unsigned char
-            channel[sizeof(size_t)];
-
           /*
             Convert to multi-byte color-mapped X canvas.
           */
@@ -6147,11 +6144,9 @@
               pixel=pixels[(ssize_t) GetPixelIndex(canvas,p)];
               for (k=0; k < (int) bytes_per_pixel; k++)
               {
-                channel[k]=(unsigned char) pixel;
+                *q++=(unsigned char) (pixel & 0xff);
                 pixel>>=8;
               }
-              for (k=0; k < (int) bytes_per_pixel; k++)
-                *q++=channel[k];
               p+=GetPixelChannels(canvas);
             }
             q+=scanline_pad;
@@ -6381,13 +6376,9 @@
                 register unsigned int
                   bytes_per_pixel;
 
-                unsigned char
-                  channel[sizeof(size_t)];
-
                 /*
                   Convert to multi-byte continuous-tone X canvas.
                 */
-                (void) ResetMagickMemory(channel,0,sizeof(channel));
                 bytes_per_pixel=(unsigned int) (ximage->bits_per_pixel >> 3);
                 for (y=0; y < (int) canvas->rows; y++)
                 {
@@ -6400,11 +6391,9 @@
                     pixel=XGammaPixel(canvas,map_info,p);
                     for (k=0; k < (int) bytes_per_pixel; k++)
                     {
-                      channel[k]=(unsigned char) pixel;
+                      *q++=(unsigned char) (pixel & 0xff);
                       pixel>>=8;
                     }
-                    for (k=0; k < (int) bytes_per_pixel; k++)
-                      *q++=channel[k];
                     p+=GetPixelChannels(canvas);
                   }
                   q+=scanline_pad;