add converting grayscale image into defaults when generating thumbnail 93/236093/6
authorjiyong.min <jiyong.min@samsung.com>
Mon, 15 Jun 2020 00:09:50 +0000 (09:09 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Tue, 16 Jun 2020 03:35:05 +0000 (12:35 +0900)
  Problem. A thumbnail of grayscale image was not visible
  - Cause: Grayscale image was not supported by graphics
  - Solution: Add converting grayscale into defaults(rgb or true-color)

Change-Id: Ibaa1617834de6646e673b6bbc82ae8ec403b5788

magick/mm_util_magick.c

index 44babdb..b2a7eae 100644 (file)
@@ -1194,6 +1194,7 @@ int mm_util_resize_and_rotate_P_P(const char *src_path, unsigned int req_width,
        Image *_image = NULL;
        Image *_resized_image = NULL;
        Image *_rotated_image = NULL;
+       Image *_write_image = NULL;
        ExceptionInfo exception;
        mm_util_rotate_type_e rotation = MM_UTIL_ROTATE_0;
 
@@ -1255,7 +1256,18 @@ int mm_util_resize_and_rotate_P_P(const char *src_path, unsigned int req_width,
                }
        }
 
-       ret = __mm_util_write_image_to_file(((_rotated_image) ? _rotated_image : _resized_image), dst_path);
+       _write_image = (_rotated_image) ? _rotated_image : _resized_image;
+
+       /* problem. a thumbnail of grayscale image is invisible
+          add converting grayscale image into rgb(jpeg) or true color(png)
+          the rgb(jpeg) and true-color(png) are default(else case) value.
+        */
+       if (IsGrayImage(_write_image, &exception)) {
+               mm_util_info("IsGrayImage, convert image into rgb(jpeg)/true-color(png).");
+               _write_image->is_grayscale = MagickFalse;
+       }
+
+       ret = __mm_util_write_image_to_file(_write_image, dst_path);
 
 ERROR: