[gimp/gimp-2-10] plug-ins: add support for grayscale images in psp reader.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: add support for grayscale images in psp reader.
- Date: Sat, 12 Sep 2020 10:08:25 +0000 (UTC)
commit 9ec44fd835ee806c11c807b2031e378f271de6a9
Author: Jacob Boerema <jgboerema gmail com>
Date: Tue Sep 8 22:29:45 2020 -0400
plug-ins: add support for grayscale images in psp reader.
(cherry picked from commit 2054f9f1634480890cf457d9037eff064bae100c)
plug-ins/common/file-psp.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c
index 1f1244f230..726324503c 100644
--- a/plug-ins/common/file-psp.c
+++ b/plug-ins/common/file-psp.c
@@ -935,10 +935,10 @@ read_general_image_attribute_block (FILE *f,
else
ia->bytes_per_sample = 1;
- if (ia->base_type != GIMP_RGB)
+ if (ia->base_type == GIMP_INDEXED)
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
- _("Unsupported bit depth %d"), ia->depth);
+ _("Indexed images are not supported"));
return -1;
}
@@ -1778,16 +1778,21 @@ read_layer_block (FILE *f,
null_layer = TRUE;
}
- if (ia->grayscale)
- if (!null_layer && bitmap_count == 1)
+ if (ia->base_type == GIMP_RGB)
+ if (bitmap_count == 1)
+ drawable_type = GIMP_RGB_IMAGE, bytespp = 3;
+ else
+ drawable_type = GIMP_RGBA_IMAGE, bytespp = 4;
+ else if (ia->base_type == GIMP_GRAY)
+ if (bitmap_count == 1)
drawable_type = GIMP_GRAY_IMAGE, bytespp = 1;
else
- drawable_type = GIMP_GRAYA_IMAGE, bytespp = 1;
+ drawable_type = GIMP_GRAYA_IMAGE, bytespp = 2;
else
- if (!null_layer && bitmap_count == 1)
- drawable_type = GIMP_RGB_IMAGE, bytespp = 3;
+ if (bitmap_count == 1)
+ drawable_type = GIMP_INDEXED_IMAGE, bytespp = 1;
else
- drawable_type = GIMP_RGBA_IMAGE, bytespp = 4;
+ drawable_type = GIMP_INDEXEDA_IMAGE, bytespp = 2;
bytespp *= ia->bytes_per_sample;
layer_ID = gimp_layer_new (image_ID, layer_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]