Commit ea642e50f for imagemagick.org
commit ea642e50f593ef60841c10b4b5ba87666bdbd7ba
Author: Cristy <urban-warrior@imagemagick.org>
Date: Fri Oct 16 22:07:22 2026 -0400
add shuffle demo
diff --git a/PerlMagick/demo/Makefile b/PerlMagick/demo/Makefile
index ad14b69b3..b4a835498 100644
--- a/PerlMagick/demo/Makefile
+++ b/PerlMagick/demo/Makefile
@@ -11,7 +11,8 @@ all:
perl single-pixels.pl
perl annotate.pl
perl composite.pl
+ perl shuffle.pl
clean:
/bin/rm -f demo.pam button.pam model.pam shadow.pam tree.pam \
- compose-specials.pam single-pixels.pam pixel-fx.pam
+ compose-specials.pam single-pixels.pam pixel-fx.pam shuffle.pam
diff --git a/PerlMagick/demo/shuffle.pl b/PerlMagick/demo/shuffle.pl
new file mode 100644
index 000000000..f74013f8c
--- /dev/null
+++ b/PerlMagick/demo/shuffle.pl
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+#
+# Shuffle image sequence.
+#
+use strict;
+use warnings;
+use Image::Magick;
+use List::Util qw(shuffle);
+
+# Instantiate a new Image::Magick object
+my $image = Image::Magick->new();
+
+# Read the built-in images into the sequence
+my $status = $image->Read('model.gif', 'red-flower.gif', 'tile.gif',
+ 'pink-flower.gif', 'smile.gif', 'yellow-flower.gif');
+die "Error reading images: $status" if "$status";
+
+# Extract the image sequence into a native Perl array,
+# shuffle it randomly, clear the object, and push them back.
+my @images = @$image;
+@$image = ();
+push(@$image, shuffle(@images));
+
+# Write the shuffled image sequence
+print "Write...\n";
+foreach my $img (@$image) {
+ $status = $img->Resize(geometry => '320x320');
+ die "Error resizing image: $status" if "$status";
+}
+$image->Write('ashlar:shuffle.pam');
+print "Display...\n";
+my $shuffle = Image::Magick->new();
+my $status = $shuffle->Read('shuffle.pam');
+$shuffle->Write(magick=>'SHOW',title=>"Shuffle");
+