]> granicus.if.org Git - imagemagick/blobdiff - coders/gradient.c
(no commit message)
[imagemagick] / coders / gradient.c
index 5682ab30460d0192d12b438c249302a716bb0121..03c927b41011fb79d197c587cb7fe4c41aaae013 100644 (file)
@@ -44,6 +44,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/draw.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
@@ -145,7 +146,6 @@ static Image *ReadGRADIENTImage(const ImageInfo *image_info,
         start_color.green);
       start_color.blue=QuantumRange*DecompandsRGB(QuantumScale*
         start_color.blue);
-      start_color.colorspace=RGBColorspace;
     }
   if (IssRGBColorspace(stop_color.colorspace) != MagickFalse)
     {
@@ -155,7 +155,6 @@ static Image *ReadGRADIENTImage(const ImageInfo *image_info,
         stop_color.green);
       stop_color.blue=QuantumRange*DecompandsRGB(QuantumScale*
         stop_color.blue);
-      stop_color.colorspace=RGBColorspace;
     }
   status=GradientImage(image,LocaleCompare(image_info->magick,"GRADIENT") == 0 ?
     LinearGradient : RadialGradient,PadSpread,&start_color,&stop_color,
@@ -168,6 +167,11 @@ static Image *ReadGRADIENTImage(const ImageInfo *image_info,
   (void) SetImageColorspace(image,start_color.colorspace,exception);
   if ((start_color.matte == MagickFalse) && (stop_color.matte == MagickFalse))
     (void) SetImageAlphaChannel(image,DeactivateAlphaChannel,exception);
+  if (IssRGBColorspace(start_color.colorspace) != MagickFalse)
+    {
+      (void) SetImageColorspace(image,RGBColorspace,exception);
+      (void) TransformImageColorspace(image,sRGBColorspace,exception);
+    }
   return(GetFirstImageInList(image));
 }
 \f