mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
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
1 changed files with 22 additions and 0 deletions
|
@ -831,6 +831,28 @@ print_preview_get_thumbnail (GimpDrawable *drawable,
|
||||||
width, height,
|
width, height,
|
||||||
&width, &height, &bpp);
|
&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)
|
switch (bpp)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue