[PATCH] display command does'nt change colorspace to sRGB if needed
Posted: 2019-06-08T17:04:45-07:00
I've compiled imagemagick support for HEIC and i've noticed that the display command displays my pictures with the wrong colorspace. After having looking into the code i noticed that the readimage function returned images using the YCbCr colorspace and that the display command tried to display it without changing the colorspace to sRGB.
Here is proposal patch for fixing this issue (imagemagick 7) :
diff --git a/MagickWand/display.c b/MagickWand/display.c
index a63ec7a51..eca8c047d 100644
--- a/MagickWand/display.c
+++ b/MagickWand/display.c
@@ -487,6 +487,11 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info,
(void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
images=ReadImage(image_info,exception);
CatchException(exception);
+ if (images->colorspace != sRGBColorspace)
+ {
+ (void) TransformImageColorspace(images,sRGBColorspace,exception);
+ CatchException(exception);
+ }
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)
Here is proposal patch for fixing this issue (imagemagick 7) :
diff --git a/MagickWand/display.c b/MagickWand/display.c
index a63ec7a51..eca8c047d 100644
--- a/MagickWand/display.c
+++ b/MagickWand/display.c
@@ -487,6 +487,11 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info,
(void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
images=ReadImage(image_info,exception);
CatchException(exception);
+ if (images->colorspace != sRGBColorspace)
+ {
+ (void) TransformImageColorspace(images,sRGBColorspace,exception);
+ CatchException(exception);
+ }
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)