# from memory, untested: my $img = Image::Magick->new(); my $res = $img->Read( filename => $filename ); die $res if $res; my @images = @$img; printf "Found %s image(s)\n", scalar @images; for my $output_image (@images) { print "Writing $target"; my $target = sprintf "test.%s.png"; $output_image->Write( filename => $target ); print "\n"; };