Commit b1bc24189 for imagemagick.org

commit b1bc241893c5d67c0c1062f953e4b093fd43c25d
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Sat Oct 17 08:08:01 2026 -0400

    completing the shuffle framework

diff --git a/MagickCore/list.c b/MagickCore/list.c
index afd217e46..b4c826f20 100644
--- a/MagickCore/list.c
+++ b/MagickCore/list.c
@@ -1338,23 +1338,23 @@ MagickExport void ReverseImageList(Image **images)
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
 %  ShuffleImages() reorders the sequence of images in an image list based on
-%  ascending, descending, or random criteria.
+%  ascending, descending, or random mode.
 %
 %  The format of the ShuffleImages method is:
 %
-%      Image *ShuffleImages(Image **images,const ShuffleStrategy strategy,
+%      Image *ShuffleImages(Image **images,const ShuffleMode mode,
 %        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
 %    o images: the image list.
 %
-%    o strategy: the shuffle strategy (ascending, descending, random).
+%    o mode: the shuffle mode (ascending, descending, random).
 %
 %    o exception: return any errors or warnings in this structure.
 %
 */
-MagickExport Image *ShuffleImages(Image **images,const ShuffleStrategy strategy,
+MagickExport Image *ShuffleImages(Image **images,const ShuffleMode mode,
   ExceptionInfo *exception)
 {
   Image
@@ -1399,7 +1399,7 @@ MagickExport Image *ShuffleImages(Image **images,const ShuffleStrategy strategy,
       image=image->next;
     }
   }
-  switch (strategy)
+  switch (mode)
   {
     case AscendingShuffle:
     {
diff --git a/MagickCore/list.h b/MagickCore/list.h
index 5327cd50b..4f083e6ad 100644
--- a/MagickCore/list.h
+++ b/MagickCore/list.h
@@ -28,7 +28,7 @@ typedef enum
   RandomShuffle,
   AscendingShuffle,
   DescendingShuffle
-} ShuffleStrategy;
+} ShuffleMode;

 extern MagickExport Image
   *CloneImageList(const Image *,ExceptionInfo *),
@@ -45,7 +45,7 @@ extern MagickExport Image
   *RemoveImageFromList(Image **),
   *RemoveLastImageFromList(Image **),
   *RemoveFirstImageFromList(Image **),
-  *ShuffleImages(Image **,const ShuffleStrategy,ExceptionInfo *),
+  *ShuffleImages(Image **,const ShuffleMode,ExceptionInfo *),
   *SpliceImageIntoList(Image **,const size_t,const Image *),
   *SplitImageList(Image *),
   *SyncNextImageInList(const Image *);
diff --git a/MagickWand/deprecate.c b/MagickWand/deprecate.c
index 9622d734a..8b59c4146 100644
--- a/MagickWand/deprecate.c
+++ b/MagickWand/deprecate.c
@@ -296,6 +296,7 @@ static MagickBooleanType ConvertUsage(void)
       "  -shadow geometry     simulate an image shadow\n"
       "  -sharpen geometry    sharpen the image\n"
       "  -shave geometry      shave pixels from the image edges\n"
+      "  -shuffle strategy    reorders the sequence of images\n"
       "  -shear geometry      slide one edge of the image along the X or Y axis\n"
       "  -sigmoidal-contrast geometry\n"
       "                       increase the contrast without saturating highlights or\n"
@@ -2869,6 +2870,23 @@ WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info,
               ThrowConvertInvalidArgumentException(option,argv[i]);
             break;
           }
+        if (LocaleCompare("shuffle",option+1) == 0)
+          {
+            ssize_t
+              mode;
+
+            mode=UndefinedShuffle;
+            if (*option == '+')
+              break;
+            i++;
+            if (i == (ssize_t) argc)
+              ThrowConvertException(OptionError,"MissingArgument",option);
+            mode=ParseCommandOption(MagickShuffleOptions,MagickFalse,argv[i]);
+            if (mode < 0)
+              ThrowConvertException(OptionError,"UnrecognizedImageOrientation",
+                argv[i]);
+            break;
+          }
         if (LocaleCompare("sigmoidal-contrast",option+1) == 0)
           {
             i++;
diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c
index 331a4d3fc..6b632bb69 100644
--- a/MagickWand/mogrify.c
+++ b/MagickWand/mogrify.c
@@ -3580,7 +3580,6 @@ static MagickBooleanType MogrifyUsage(void)
       "                       terms (coefficients and degree pairs).\n"
       "  -print string        interpret string and print to console\n"
       "  -process arguments   process the image with a custom image filter\n"
-      "  -shuffle strategy    reorders the sequence of images\n"
       "  -smush geometry      smush an image sequence together\n"
       "  -write filename      write images to this file",
     settings[] =
@@ -6132,24 +6131,6 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info,
               ThrowMogrifyInvalidArgumentException(option,argv[i]);
             break;
           }
-        if (LocaleCompare("shuffle",option+1) == 0)
-          {
-            ssize_t
-              strategy;
-
-            strategy=UndefinedShuffle;
-            if (*option == '+')
-              break;
-            i++;
-            if (i == (ssize_t) argc)
-              ThrowMogrifyException(OptionError,"MissingArgument",option);
-            strategy=ParseCommandOption(MagickShuffleOptions,MagickFalse,
-              argv[i]);
-            if (strategy < 0)
-              ThrowMogrifyException(OptionError,"UnrecognizedImageOrientation",
-                argv[i]);
-            break;
-          }
         if (LocaleCompare("sigmoidal-contrast",option+1) == 0)
           {
             i++;
@@ -8943,11 +8924,11 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
       {
         if (LocaleCompare("shuffle",option+1) == 0)
           {
-            ShuffleStrategy
+            ShuffleMode
               shuffle_type;

             (void) SyncImagesSettings(mogrify_info,*images,exception);
-            shuffle_type=(ShuffleStrategy) ParseCommandOption(
+            shuffle_type=(ShuffleMode) ParseCommandOption(
               MagickShuffleOptions,MagickFalse,argv[i+1]);
             (void) ShuffleImages(&(*images),shuffle_type,exception);
             break;
diff --git a/MagickWand/montage.c b/MagickWand/montage.c
index 17647c6a3..872630f04 100644
--- a/MagickWand/montage.c
+++ b/MagickWand/montage.c
@@ -114,6 +114,7 @@ static MagickBooleanType MontageUsage(void)
       "  -resize geometry     resize the image\n"
       "  -rotate degrees      apply Paeth rotation to the image\n"
       "  -scale geometry      scale the image\n"
+      "  -shuffle strategy    reorders the sequence of images\n"
       "  -strip               strip image of all profiles and comments\n"
       "  -transform           affine transform image\n"
       "  -transpose           flip image vertically and rotate 90 degrees\n"
@@ -1553,6 +1554,23 @@ WandExport MagickBooleanType MontageImageCommand(ImageInfo *image_info,
               ThrowMontageException(OptionError,"MissingArgument",option);
             break;
           }
+        if (LocaleCompare("shuffle",option+1) == 0)
+          {
+            ssize_t
+              mode;
+
+            mode=UndefinedShuffle;
+            if (*option == '+')
+              break;
+            i++;
+            if (i == (ssize_t) argc)
+              ThrowMontageException(OptionError,"MissingArgument",option);
+            mode=ParseCommandOption(MagickShuffleOptions,MagickFalse,argv[i]);
+            if (mode < 0)
+              ThrowMontageException(OptionError,"UnrecognizedImageShuffle",
+                argv[i]);
+            break;
+          }
         if (LocaleCompare("size",option+1) == 0)
           {
             if (*option == '+')
diff --git a/MagickWand/operation.c b/MagickWand/operation.c
index 08fe15cb3..6e087f42e 100644
--- a/MagickWand/operation.c
+++ b/MagickWand/operation.c
@@ -4695,9 +4695,9 @@ static MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
         {
           parse=ParseCommandOption(MagickShuffleOptions,MagickFalse,arg1);
           if ( parse < 0 )
-            CLIWandExceptArgBreak(OptionError,"UnrecognizedShuffleStrategy",
+            CLIWandExceptArgBreak(OptionError,"UnrecognizedShuffleMode",
               option,arg1);
-          (void) ShuffleImages(&_images,(ShuffleStrategy) parse,_exception);
+          (void) ShuffleImages(&_images,(ShuffleMode) parse,_exception);
           break;
         }
       if (LocaleCompare("smush",option+1) == 0)