add converting grayscale image into defaults when generating thumbnail 94/236094/5
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 07:02:42 +0000 (16:02 +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 0c8aad81d8c8849d23029dcdfa131116285a4bbf..e80ddf5e87b8b219cdb248ef4d638cc24b85f987 100644 (file)
@@ -848,6 +848,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_magick_rotate_type rotation = MM_UTIL_ROTATE_0;
 
@@ -909,7 +910,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: