mirror of https://github.com/GNOME/gimp.git
plug-ins: Convert Print Preview for images with higher bit depth
Resolves #13104 print_preview_get_thumbnail () crashes when trying to display thumbnails where the image's precision is higher than 8 BPC. While the plan is to rewrite/replace this plug-in, for now, we'll duplicate the drawable's image and convert to 8BPC to prevent issues.
This commit is contained in:
parent
f576531bec
commit
40fe4fc62f
|
@ -831,6 +831,28 @@ print_preview_get_thumbnail (GimpDrawable *drawable,
|
|||
width, height,
|
||||
&width, &height, &bpp);
|
||||
|
||||
/* For now, convert preview of higher bit depth to 8BPC */
|
||||
if (bpp > 4)
|
||||
{
|
||||
GimpImage *temp_image;
|
||||
GList *layers = NULL;
|
||||
|
||||
g_bytes_unref (data);
|
||||
|
||||
temp_image =
|
||||
gimp_image_duplicate (gimp_item_get_image (GIMP_ITEM (drawable)));
|
||||
gimp_image_convert_precision (temp_image, GIMP_PRECISION_U8_NON_LINEAR);
|
||||
gimp_image_merge_visible_layers (temp_image, GIMP_CLIP_TO_IMAGE);
|
||||
|
||||
layers = gimp_image_list_layers (temp_image);
|
||||
data = gimp_drawable_get_thumbnail_data (GIMP_DRAWABLE (layers->data),
|
||||
width, height,
|
||||
&width, &height, &bpp);
|
||||
|
||||
g_list_free (layers);
|
||||
gimp_image_delete (temp_image);
|
||||
}
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 1:
|
||||
|
|
Loading…
Reference in New Issue