[gegl] jpg-save: store CMYK jpg's if provided buffer has a CMYK babl space
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] jpg-save: store CMYK jpg's if provided buffer has a CMYK babl space
- Date: Sat, 24 Nov 2018 03:02:23 +0000 (UTC)
commit c8af2ff1d1a38b79cf849147ad3fa72f366fca12
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Nov 11 05:02:05 2018 +0100
jpg-save: store CMYK jpg's if provided buffer has a CMYK babl space
operations/external/jpg-save.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/operations/external/jpg-save.c b/operations/external/jpg-save.c
index d70f08a10..2645a2601 100644
--- a/operations/external/jpg-save.c
+++ b/operations/external/jpg-save.c
@@ -239,6 +239,7 @@ export_jpg (GeglOperation *operation,
const Babl *format;
const Babl *fmt = gegl_buffer_get_format (input);
const Babl *space = babl_format_get_space (fmt);
+ gint cmyk = babl_space_is_cmyk (space);
src_x = result->x;
src_y = result->y;
@@ -250,8 +251,16 @@ export_jpg (GeglOperation *operation,
if (!grayscale)
{
- cinfo.input_components = 3;
- cinfo.in_color_space = JCS_RGB;
+ if (cmyk)
+ {
+ cinfo.input_components = 4;
+ cinfo.in_color_space = JCS_CMYK;
+ }
+ else
+ {
+ cinfo.input_components = 3;
+ cinfo.in_color_space = JCS_RGB;
+ }
}
else
{
@@ -294,8 +303,16 @@ export_jpg (GeglOperation *operation,
if (!grayscale)
{
- format = babl_format_with_space ("R'G'B' u8", space);
- row_pointer[0] = g_malloc (width * 3);
+ if (cmyk)
+ {
+ format = babl_format_with_space ("cmyk u8", space);
+ row_pointer[0] = g_malloc (width * 4);
+ }
+ else
+ {
+ format = babl_format_with_space ("R'G'B' u8", space);
+ row_pointer[0] = g_malloc (width * 3);
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]