[gimp/gimp-2-10] plug-ins: in file-psd, fix u8 channel format
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: in file-psd, fix u8 channel format
- Date: Sun, 26 Apr 2020 20:39:13 +0000 (UTC)
commit ccc9bd1849b688536d00856f75ae2135af251ac6
Author: Ell <ell_se yahoo com>
Date: Sun Apr 26 22:39:34 2020 +0300
plug-ins: in file-psd, fix u8 channel format
In file-psd, use a non-linear channel format when the image
precision is u8 non-linear, as per gimp_image_get_channel_format().
plug-ins/file-psd/psd-load.c | 3 ++-
plug-ins/file-psd/psd-save.c | 24 +++++++++++++++++++-----
2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index a73011efe8..972b3c367d 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -2538,7 +2538,8 @@ get_channel_format (PSDimage *img_a)
case 8:
case 1:
- format = babl_format ("Y u8");
+ /* see gimp_image_get_channel_format() */
+ format = babl_format ("Y' u8");
break;
default:
diff --git a/plug-ins/file-psd/psd-save.c b/plug-ins/file-psd/psd-save.c
index 52eab07387..40475bb33b 100644
--- a/plug-ins/file-psd/psd-save.c
+++ b/plug-ins/file-psd/psd-save.c
@@ -1736,6 +1736,7 @@ get_bpc (gint32 image_id)
static const Babl *
get_pixel_format (gint32 drawableID)
{
+ gint32 image_id = gimp_item_get_image (drawableID);
const gchar *model;
gint bpc;
gchar format[32];
@@ -1766,7 +1767,7 @@ get_pixel_format (gint32 drawableID)
g_return_val_if_reached (NULL);
}
- bpc = get_bpc (gimp_item_get_image (drawableID));
+ bpc = get_bpc (gimp_item_get_image (image_id));
sprintf (format, "%s u%d", model, 8 * bpc);
@@ -1776,10 +1777,15 @@ get_pixel_format (gint32 drawableID)
static const Babl *
get_channel_format (gint32 drawableID)
{
- gint bpc;
- gchar format[32];
+ gint32 image_id = gimp_item_get_image (drawableID);
+ gint bpc;
+ gchar format[32];
- bpc = get_bpc (gimp_item_get_image (drawableID));
+ /* see gimp_image_get_channel_format() */
+ if (gimp_image_get_precision (image_id) == GIMP_PRECISION_U8_GAMMA)
+ return babl_format ("Y' u8");
+
+ bpc = get_bpc (image_id);
sprintf (format, "Y u%d", 8 * bpc);
@@ -1789,7 +1795,15 @@ get_channel_format (gint32 drawableID)
static const Babl *
get_mask_format (gint32 drawableID)
{
- return get_channel_format (drawableID);
+ gint32 image_id = gimp_item_get_image (drawableID);
+ gint bpc;
+ gchar format[32];
+
+ bpc = get_bpc (image_id);
+
+ sprintf (format, "Y u%d", 8 * bpc);
+
+ return babl_format (format);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]