From df7e7caf1dedf3fa06dd0d5d84efb7f3a260b874 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Tue, 9 May 2017 07:11:02 -0400
Subject: [PATCH] 
 https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31855

---
 ChangeLog              | 2 ++
 MagickWand/mogrify.c   | 2 ++
 MagickWand/operation.c | 2 ++
 configure              | 2 +-
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d4a335e51..c59b10bea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
     https://github.com/ImageMagick/ImageMagick/issues/463).
   * The +opaque option now works on all channels (reference
     https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31862).
+  * Ensure backwards compatibility for the -combine option (reference
+    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31855).
 
 2017-04-24  7.0.5-5 Cristy  <quetzlzacatenango@image...>
   * Release ImageMagick version 7.0.5-5, GIT revision 19915:12eec43:20170424.
diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c
index 770b5e9c9..d26589c11 100644
--- a/MagickWand/mogrify.c
+++ b/MagickWand/mogrify.c
@@ -7820,6 +7820,8 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
 
             (void) SyncImagesSettings(mogrify_info,*images,exception);
             colorspace=(*images)->colorspace;
+            if ((*images)->number_channels < GetImageListLength(*images))
+              colorspace=sRGBColorspace;
             if (*option == '+')
               colorspace=(ColorspaceType) ParseCommandOption(
                 MagickColorspaceOptions,MagickFalse,argv[i+1]);
diff --git a/MagickWand/operation.c b/MagickWand/operation.c
index 8d8e63c13..6baf672e6 100644
--- a/MagickWand/operation.c
+++ b/MagickWand/operation.c
@@ -3824,6 +3824,8 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
       if (LocaleCompare("combine",option+1) == 0)
         {
           parse=(ssize_t) _images->colorspace;
+          if (_images->number_channels < GetImageListLength(_images))
+            parse=sRGBColorspace;
           if ( IfPlusOp )
             parse=ParseCommandOption(MagickColorspaceOptions,MagickFalse,arg1);
           if (parse < 0)
diff --git a/configure b/configure
index 5b5c9873f..3a0075c40 100755
--- a/configure
+++ b/configure
@@ -4519,7 +4519,7 @@ MAGICK_PATCHLEVEL_VERSION=6
 
 MAGICK_VERSION=7.0.5-6
 
-MAGICK_GIT_REVISION=19916:f1208a9:20170425
+MAGICK_GIT_REVISION=20022:5239ac0:20170509
 
 
 # Substitute library versioning
-- 
2.40.0