Finalise -duplicate option

diff --git a/ChangeLog b/ChangeLog
index 9eab4df..e45cf0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-23 6.6.8-7 Anthony Thyssen <A.Thyssen@griffith...>
+  * Another fix for -sparse-color and unused color channels
+  * Finialize the -duplicate option created by Cristy
+
 2011-03-21  6.6.8-7 Glenn Randers-Pehrson <glennrp@image...>
   * Revised the PNG8 encoder to use 50% threshold instead of 0% when
     reducing transparency to binary.  Collapse all resulting fully transparent
@@ -5,9 +9,6 @@
   * First try the 4-4-4 and 3-3-3 palettes instead of 3-3-2, to preserve
     colors (especially gray) better, when reducing to PNG8.
 
-2011-03-18 6.6.8-7 Anthony Thyssen <A.Thyssen@griffith...>
-  * Another fix for -sparse-color and unused color channels
-
 2011-03-21  6.6.8-6 Cristy  <quetzlzacatenango@image...>
   * New version 6.6.8-6.
 
diff --git a/magick/option.c b/magick/option.c
index fe78231..af1f284 100644
--- a/magick/option.c
+++ b/magick/option.c
@@ -305,8 +305,8 @@
     { "-dither", 1L, MagickFalse },
     { "+draw", 0L, MagickFalse },
     { "-draw", 1L, MagickFalse },
-    { "+duplicate", 1L, MagickFalse },
-    { "-duplicate", 2L, MagickFalse },
+    { "+duplicate", 0L, MagickFalse },
+    { "-duplicate", 1L, MagickFalse },
     { "+duration", 1L, MagickFalse },
     { "-duration", 1L, MagickFalse },
     { "+edge", 0L, MagickFalse },
diff --git a/wand/convert.c b/wand/convert.c
index d6f14b5..2087b90 100644
--- a/wand/convert.c
+++ b/wand/convert.c
@@ -310,7 +310,6 @@
       "-mosaic              create a mosaic from an image sequence",
       "-print string        interpret string and print to console",
       "-process arguments   process the image with a custom image filter",
-      "-reverse             reverse image sequence",
       "-separate            separate an image channel into a grayscale image",
       "-smush geometry      smush an image sequence together",
       "-write filename      write images to this file",
@@ -417,6 +416,7 @@
       "-duplicate count[,index]",
       "                     duplicate an image one or more times",
       "-insert index        insert last image into the image sequence",
+      "-reverse             reverse image sequence",
       "-swap indexes        swap two images in the image sequence",
       (char *) NULL
     };
@@ -1286,11 +1286,6 @@
           }
         if (LocaleCompare("duplicate",option+1) == 0)
           {
-            i++;
-            if (i == (ssize_t) (argc-1))
-              ThrowConvertException(OptionError,"MissingArgument",option);
-            if (IsGeometry(argv[i]) == MagickFalse)
-              ThrowConvertInvalidArgumentException(option,argv[i]);
             if (*option == '+')
               break;
             i++;
diff --git a/wand/mogrify.c b/wand/mogrify.c
index 405ec9b..fb5e8f9 100644
--- a/wand/mogrify.c
+++ b/wand/mogrify.c
@@ -3830,7 +3830,6 @@
       "-mosaic              create a mosaic from an image sequence",
       "-print string        interpret string and print to console",
       "-process arguments   process the image with a custom image filter",
-      "-reverse             reverse image sequence",
       "-separate            separate an image channel into a grayscale image",
       "-smush geometry      smush an image sequence together",
       "-write filename      write images to this file",
@@ -3936,6 +3935,7 @@
       "-duplicate count[,index]",
       "                     duplicate an image one or more times",
       "-insert index        insert last image into the image sequence",
+      "-reverse             reverse image sequence",
       "-swap indexes        swap two images in the image sequence",
       (char *) NULL
     };
@@ -4795,11 +4795,6 @@
           }
         if (LocaleCompare("duplicate",option+1) == 0)
           {
-            i++;
-            if (i == (ssize_t) (argc-1))
-              ThrowMogrifyException(OptionError,"MissingArgument",option);
-            if (IsGeometry(argv[i]) == MagickFalse)
-              ThrowMogrifyInvalidArgumentException(option,argv[i]);
             if (*option == '+')
               break;
             i++;
@@ -7961,22 +7956,24 @@
           }
         if (LocaleCompare("duplicate",option+1) == 0)
           {
-            Image
-              *duplicate_images;
-
             size_t
               number_duplicates;
 
-            number_duplicates=(ssize_t) StringToLong(argv[i+1]);
-            if (*option == '+')
-              duplicate_images=DuplicateImages(*images,number_duplicates,"-1",
-                exception);
+            char
+              *p;
+
+            if (*option == '+') {
+              AppendImageToList(images,DuplicateImages(*images,1,"-1",
+                     exception));
+              break;
+            }
+            number_duplicates=(size_t) StringToLong(argv[i+1]);
+            if ( (p=strchr(argv[i+1],',')) != (char *)NULL )
+              AppendImageToList(images,DuplicateImages(*images,
+                     number_duplicates,p,exception));
             else
-              duplicate_images=DuplicateImages(*images,number_duplicates,
-                argv[i+2],exception);
-            if (*images != (Image *) NULL)
-              *images=DestroyImage(*images);
-            *images=duplicate_images;
+              AppendImageToList(images,DuplicateImages(*images,
+                     number_duplicates,"-1",exception));
             break;
           }
         break;