1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Alx Sa
cb17a72322 Load CMYK JPEG2000 images directly 2025-07-26 15:32:25 +00:00
Alx Sa
457f9a0030 Export CMYK PSDs directly 2025-07-26 15:09:23 +00:00
Alx Sa
032de4a782 Export CMYK JPEGs directly 2025-07-26 12:43:06 +00:00
Alx Sa
0076c98b51 Export CMYK TIFF directly 2025-07-25 23:15:25 +00:00
Alx Sa
afdd247759 Import and Export CMYK images 2025-07-25 15:54:15 -04:00
Alx Sa
07c2275a0e *: First steps for full CMYK mode
Very much WIP.
2025-07-25 15:54:15 -04:00
45 changed files with 1186 additions and 487 deletions

View File

@@ -186,6 +186,11 @@ static const GimpRadioActionEntry image_convert_base_type_actions[] =
NC_("image-convert-action", "Convert the image to the RGB colorspace"),
GIMP_RGB, GIMP_HELP_IMAGE_CONVERT_RGB },
{ "image-convert-cmyk", GIMP_ICON_CONVERT_CMYK,
NC_("image-convert-action", "_CMYK..."), NULL, { NULL },
NC_("image-convert-action", "Convert the image to the CMYK colorspace"),
GIMP_CMYK, GIMP_HELP_IMAGE_CONVERT_CMYK },
{ "image-convert-grayscale", GIMP_ICON_CONVERT_GRAYSCALE,
NC_("image-convert-action", "_Grayscale"), NULL, { NULL },
NC_("image-convert-action", "Convert the image to grayscale"),
@@ -434,6 +439,7 @@ image_actions_update (GimpActionGroup *group,
switch (base_type)
{
case GIMP_RGB: action = "image-convert-rgb"; break;
case GIMP_CMYK: action = "image-convert-cmyk"; break;
case GIMP_GRAY: action = "image-convert-grayscale"; break;
case GIMP_INDEXED: action = "image-convert-indexed"; break;
}
@@ -532,6 +538,7 @@ image_actions_update (GimpActionGroup *group,
}
SET_SENSITIVE ("image-convert-rgb", image);
SET_SENSITIVE ("image-convert-cmyk", image);
SET_SENSITIVE ("image-convert-grayscale", image);
SET_SENSITIVE ("image-convert-indexed", image && !groups && is_u8_gamma);

View File

@@ -88,6 +88,14 @@ static void image_convert_rgb_callback (GtkWidget *dialog
gboolean bpc,
gpointer user_data);
static void image_convert_cmyk_callback (GtkWidget *dialog,
GimpImage *image,
GimpColorProfile *new_profile,
GFile *new_file,
GimpColorRenderingIntent intent,
gboolean bpc,
gpointer user_data);
static void image_convert_gray_callback (GtkWidget *dialog,
GimpImage *image,
GimpColorProfile *new_profile,
@@ -277,8 +285,10 @@ image_convert_base_type_cmd_callback (GimpAction *action,
switch (base_type)
{
case GIMP_RGB:
case GIMP_CMYK:
case GIMP_GRAY:
if (gimp_image_get_color_profile (image))
if (gimp_image_get_color_profile (image) ||
base_type == GIMP_CMYK)
{
ColorProfileDialogType dialog_type;
GimpColorProfileCallback callback;
@@ -299,6 +309,13 @@ image_convert_base_type_cmd_callback (GimpAction *action,
default_profile = gimp_babl_get_builtin_color_profile (GIMP_RGB,
trc);
}
else if (base_type == GIMP_CMYK)
{
dialog_type = COLOR_PROFILE_DIALOG_CONVERT_TO_CMYK;
callback = image_convert_cmyk_callback;
default_profile = NULL;
}
else
{
dialog_type = COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY;
@@ -1113,6 +1130,44 @@ image_convert_rgb_callback (GtkWidget *dialog,
gtk_widget_destroy (dialog);
}
static void
image_convert_cmyk_callback (GtkWidget *dialog,
GimpImage *image,
GimpColorProfile *new_profile,
GFile *new_file,
GimpColorRenderingIntent intent,
gboolean bpc,
gpointer user_data)
{
GimpProgress *progress = user_data;
GError *error = NULL;
progress = gimp_progress_start (progress, FALSE,
_("Converting to CMYK (%s)"),
gimp_color_profile_get_label (new_profile));
if (! gimp_image_convert_type (image, GIMP_CMYK, new_profile,
progress, &error))
{
gimp_message (image->gimp, G_OBJECT (dialog),
GIMP_MESSAGE_ERROR,
"%s", error->message);
g_clear_error (&error);
if (progress)
gimp_progress_end (progress);
return;
}
if (progress)
gimp_progress_end (progress);
gimp_image_flush (image);
gtk_widget_destroy (dialog);
}
static void
image_convert_gray_callback (GtkWidget *dialog,
GimpImage *image,

View File

@@ -234,7 +234,9 @@ gimp_component_mask_get_type (void)
{ GIMP_COMPONENT_MASK_GREEN, "GIMP_COMPONENT_MASK_GREEN", "green" },
{ GIMP_COMPONENT_MASK_BLUE, "GIMP_COMPONENT_MASK_BLUE", "blue" },
{ GIMP_COMPONENT_MASK_ALPHA, "GIMP_COMPONENT_MASK_ALPHA", "alpha" },
{ GIMP_COMPONENT_MASK_ALPHA_CMYK, "GIMP_COMPONENT_MASK_ALPHA_CMYK", "alpha-cmyk" },
{ GIMP_COMPONENT_MASK_ALL, "GIMP_COMPONENT_MASK_ALL", "all" },
{ GIMP_COMPONENT_MASK_CMYK_ALL, "GIMP_COMPONENT_MASK_CMYK_ALL", "cmyk-all" },
{ 0, NULL, NULL }
};
@@ -244,7 +246,9 @@ gimp_component_mask_get_type (void)
{ GIMP_COMPONENT_MASK_GREEN, "GIMP_COMPONENT_MASK_GREEN", NULL },
{ GIMP_COMPONENT_MASK_BLUE, "GIMP_COMPONENT_MASK_BLUE", NULL },
{ GIMP_COMPONENT_MASK_ALPHA, "GIMP_COMPONENT_MASK_ALPHA", NULL },
{ GIMP_COMPONENT_MASK_ALPHA_CMYK, "GIMP_COMPONENT_MASK_ALPHA_CMYK", NULL },
{ GIMP_COMPONENT_MASK_ALL, "GIMP_COMPONENT_MASK_ALL", NULL },
{ GIMP_COMPONENT_MASK_CMYK_ALL, "GIMP_COMPONENT_MASK_CMYK_ALL", NULL },
{ 0, NULL, NULL }
};

View File

@@ -141,15 +141,22 @@ GType gimp_component_mask_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_COMPONENT_MASK_RED = 1 << 0,
GIMP_COMPONENT_MASK_GREEN = 1 << 1,
GIMP_COMPONENT_MASK_BLUE = 1 << 2,
GIMP_COMPONENT_MASK_ALPHA = 1 << 3,
GIMP_COMPONENT_MASK_RED = 1 << 0,
GIMP_COMPONENT_MASK_GREEN = 1 << 1,
GIMP_COMPONENT_MASK_BLUE = 1 << 2,
GIMP_COMPONENT_MASK_ALPHA = 1 << 3,
GIMP_COMPONENT_MASK_ALPHA_CMYK = 1 << 4,
GIMP_COMPONENT_MASK_ALL = (GIMP_COMPONENT_MASK_RED |
GIMP_COMPONENT_MASK_GREEN |
GIMP_COMPONENT_MASK_BLUE |
GIMP_COMPONENT_MASK_ALPHA)
GIMP_COMPONENT_MASK_ALPHA),
GIMP_COMPONENT_MASK_CMYK_ALL = (GIMP_COMPONENT_MASK_RED |
GIMP_COMPONENT_MASK_GREEN |
GIMP_COMPONENT_MASK_BLUE |
GIMP_COMPONENT_MASK_ALPHA |
GIMP_COMPONENT_MASK_ALPHA_CMYK)
} GimpComponentMask;

View File

@@ -30,13 +30,19 @@
/* former base/ defines */
#define MAX_CHANNELS 4
#define MAX_CHANNELS 5
#define RED 0
#define GREEN 1
#define BLUE 2
#define ALPHA 3
#define CYAN 0
#define MAGENTA 1
#define YELLOW 2
#define KEY 3
#define ALPHA_C 4
#define GRAY 0
#define ALPHA_G 1

View File

@@ -168,6 +168,7 @@ gimp_drawable_get_preview_format (GimpDrawable *drawable)
switch (gimp_drawable_get_base_type (drawable))
{
case GIMP_RGB:
case GIMP_CMYK:
case GIMP_GRAY:
return gimp_drawable_get_format (drawable);

View File

@@ -920,7 +920,10 @@ static GimpComponentMask
gimp_drawable_real_get_active_mask (GimpDrawable *drawable)
{
/* Return all, because that skips the component mask op when painting */
return GIMP_COMPONENT_MASK_ALL;
if (gimp_drawable_get_base_type (drawable) == GIMP_CMYK)
return GIMP_COMPONENT_MASK_CMYK_ALL;
else
return GIMP_COMPONENT_MASK_ALL;
}
static gboolean
@@ -1983,6 +1986,14 @@ gimp_drawable_is_rgb (GimpDrawable *drawable)
return (gimp_drawable_get_base_type (drawable) == GIMP_RGB);
}
gboolean
gimp_drawable_is_cmyk (GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return (gimp_drawable_get_base_type (drawable) == GIMP_CMYK);
}
gboolean
gimp_drawable_is_gray (GimpDrawable *drawable)
{
@@ -2022,11 +2033,32 @@ gimp_drawable_get_component_format (GimpDrawable *drawable,
gimp_drawable_get_precision (drawable),
BLUE);
/* TODO: Make conditional on CMYK */
case GIMP_CHANNEL_ALPHA:
return gimp_babl_component_format (GIMP_RGB,
gimp_drawable_get_precision (drawable),
ALPHA);
case GIMP_CHANNEL_CYAN:
return gimp_babl_component_format (GIMP_CMYK,
gimp_drawable_get_precision (drawable),
CYAN);
case GIMP_CHANNEL_MAGENTA:
return gimp_babl_component_format (GIMP_CMYK,
gimp_drawable_get_precision (drawable),
MAGENTA);
case GIMP_CHANNEL_YELLOW:
return gimp_babl_component_format (GIMP_CMYK,
gimp_drawable_get_precision (drawable),
YELLOW);
case GIMP_CHANNEL_KEY:
return gimp_babl_component_format (GIMP_CMYK,
gimp_drawable_get_precision (drawable),
KEY);
case GIMP_CHANNEL_GRAY:
return gimp_babl_component_format (GIMP_GRAY,
gimp_drawable_get_precision (drawable),
@@ -2051,12 +2083,17 @@ gimp_drawable_get_component_index (GimpDrawable *drawable,
case GIMP_CHANNEL_RED: return RED;
case GIMP_CHANNEL_GREEN: return GREEN;
case GIMP_CHANNEL_BLUE: return BLUE;
case GIMP_CHANNEL_CYAN: return CYAN;
case GIMP_CHANNEL_MAGENTA: return MAGENTA;
case GIMP_CHANNEL_YELLOW: return YELLOW;
case GIMP_CHANNEL_KEY: return KEY;
case GIMP_CHANNEL_GRAY: return GRAY;
case GIMP_CHANNEL_INDEXED: return INDEXED;
case GIMP_CHANNEL_ALPHA:
switch (gimp_drawable_get_base_type (drawable))
{
case GIMP_RGB: return ALPHA;
case GIMP_CMYK: return ALPHA_C;
case GIMP_GRAY: return ALPHA_G;
case GIMP_INDEXED: return ALPHA_I;
}

View File

@@ -222,6 +222,7 @@ GimpImageBaseType gimp_drawable_get_base_type (GimpDrawable *drawable)
GimpComponentType gimp_drawable_get_component_type (GimpDrawable *drawable);
GimpPrecision gimp_drawable_get_precision (GimpDrawable *drawable);
gboolean gimp_drawable_is_rgb (GimpDrawable *drawable);
gboolean gimp_drawable_is_cmyk (GimpDrawable *drawable);
gboolean gimp_drawable_is_gray (GimpDrawable *drawable);
gboolean gimp_drawable_is_indexed (GimpDrawable *drawable);

View File

@@ -1067,6 +1067,10 @@ get_projection_format (GimpProjectable *projectable,
return gimp_image_get_format (image, GIMP_RGB, precision, TRUE,
gimp_image_get_layer_space (image));
case GIMP_CMYK:
return gimp_image_get_format (image, GIMP_CMYK, precision, TRUE,
gimp_image_get_layer_space (image));
case GIMP_GRAY:
return gimp_image_get_format (image, GIMP_GRAY, precision, TRUE,
gimp_image_get_layer_space (image));

View File

@@ -550,6 +550,16 @@ gimp_image_validate_color_profile_by_format (const Babl *format,
return FALSE;
}
}
else if (gimp_babl_format_get_base_type (format) == GIMP_CMYK)
{
if (! gimp_color_profile_is_cmyk (profile))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("ICC profile validation failed: "
"Color profile is not for CMYK color space"));
return FALSE;
}
}
else
{
if (! gimp_color_profile_is_rgb (profile))
@@ -682,6 +692,7 @@ gimp_image_convert_color_profile (GimpImage *image,
switch (gimp_image_get_base_type (image))
{
case GIMP_RGB:
case GIMP_CMYK:
case GIMP_GRAY:
gimp_image_convert_profile_layers (image,
src_profile, dest_profile,
@@ -732,7 +743,9 @@ gimp_image_import_color_profile (GimpImage *image,
intent = GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC;
bpc = TRUE;
if (gimp_image_get_base_type (image) == GIMP_GRAY)
if (gimp_image_get_base_type (image) == GIMP_CMYK)
pref_profile = gimp_color_config_get_cmyk_color_profile (image->gimp->config->color_management, NULL);
else if (gimp_image_get_base_type (image) == GIMP_GRAY)
pref_profile = gimp_color_config_get_gray_color_profile (image->gimp->config->color_management, NULL);
else
pref_profile = gimp_color_config_get_rgb_color_profile (image->gimp->config->color_management, NULL);

View File

@@ -86,6 +86,10 @@ gimp_image_convert_type (GimpImage *image,
undo_desc = C_("undo-type", "Convert Image to RGB");
break;
case GIMP_CMYK:
undo_desc = C_("undo-type", "Convert Image to CMYK");
break;
case GIMP_GRAY:
undo_desc = C_("undo-type", "Convert Image to Grayscale");
break;
@@ -144,10 +148,12 @@ gimp_image_convert_type (GimpImage *image,
if (old_type == GIMP_INDEXED)
gimp_image_unset_colormap (image, TRUE);
/* When converting to/from GRAY, set the new profile.
/* When converting to/from GRAY or CMYK, set the new profile.
*/
if (old_type == GIMP_GRAY ||
new_type == GIMP_GRAY)
new_type == GIMP_GRAY ||
old_type == GIMP_CMYK ||
new_type == GIMP_CMYK)
{
gimp_image_set_color_profile (image, dest_profile, NULL);
}

View File

@@ -45,6 +45,7 @@ gimp_image_get_preview_format (GimpImage *image)
switch (gimp_image_get_base_type (image))
{
case GIMP_RGB:
case GIMP_CMYK:
case GIMP_GRAY:
return gimp_projectable_get_format (GIMP_PROJECTABLE (image));

View File

@@ -1570,6 +1570,11 @@ gimp_image_get_proj_format (GimpProjectable *projectable)
gimp_image_get_precision (image), TRUE,
gimp_image_get_layer_space (image));
case GIMP_CMYK:
return gimp_image_get_format (image, GIMP_CMYK,
gimp_image_get_precision (image), TRUE,
gimp_image_get_layer_space (image));
case GIMP_GRAY:
return gimp_image_get_format (image, GIMP_GRAY,
gimp_image_get_precision (image), TRUE,
@@ -1687,9 +1692,18 @@ gimp_image_get_graph (GimpProjectable *projectable)
GeglNode *channels_node;
GeglNode *output;
GimpComponentMask mask;
const Babl *image_format;
image_format = gimp_image_get_layer_format (image, TRUE);
if (private->graph)
return private->graph;
{
gegl_node_set (private->visible_mask,
"image-format", image_format,
NULL);
return private->graph;
}
private->graph = gegl_node_new ();
@@ -1698,13 +1712,17 @@ gimp_image_get_graph (GimpProjectable *projectable)
gegl_node_add_child (private->graph, layers_node);
mask = ~gimp_image_get_visible_mask (image) & GIMP_COMPONENT_MASK_ALL;
if (gimp_image_get_base_type (image) == GIMP_CMYK)
mask = ~gimp_image_get_visible_mask (image) & GIMP_COMPONENT_MASK_CMYK_ALL;
else
mask = ~gimp_image_get_visible_mask (image) & GIMP_COMPONENT_MASK_ALL;
private->visible_mask =
gegl_node_new_child (private->graph,
"operation", "gimp:mask-components",
"mask", mask,
"alpha", 1.0,
"operation", "gimp:mask-components",
"mask", mask,
"alpha", 1.0,
"image-format", image_format,
NULL);
gegl_node_link (layers_node, private->visible_mask);
@@ -2263,6 +2281,7 @@ gimp_image_get_format (GimpImage *image,
switch (base_type)
{
case GIMP_RGB:
case GIMP_CMYK:
case GIMP_GRAY:
return gimp_babl_format (base_type, precision, with_alpha, space);
@@ -3577,6 +3596,26 @@ gimp_image_get_component_format (GimpImage *image,
gimp_image_get_precision (image),
ALPHA);
case GIMP_CHANNEL_CYAN:
return gimp_babl_component_format (GIMP_CMYK,
gimp_image_get_precision (image),
CYAN);
case GIMP_CHANNEL_MAGENTA:
return gimp_babl_component_format (GIMP_CMYK,
gimp_image_get_precision (image),
MAGENTA);
case GIMP_CHANNEL_YELLOW:
return gimp_babl_component_format (GIMP_CMYK,
gimp_image_get_precision (image),
YELLOW);
case GIMP_CHANNEL_KEY:
return gimp_babl_component_format (GIMP_CMYK,
gimp_image_get_precision (image),
KEY);
case GIMP_CHANNEL_GRAY:
return gimp_babl_component_format (GIMP_GRAY,
gimp_image_get_precision (image),
@@ -3601,12 +3640,17 @@ gimp_image_get_component_index (GimpImage *image,
case GIMP_CHANNEL_RED: return RED;
case GIMP_CHANNEL_GREEN: return GREEN;
case GIMP_CHANNEL_BLUE: return BLUE;
case GIMP_CHANNEL_CYAN: return CYAN;
case GIMP_CHANNEL_MAGENTA: return MAGENTA;
case GIMP_CHANNEL_YELLOW: return YELLOW;
case GIMP_CHANNEL_KEY: return KEY;
case GIMP_CHANNEL_GRAY: return GRAY;
case GIMP_CHANNEL_INDEXED: return INDEXED;
case GIMP_CHANNEL_ALPHA:
switch (gimp_image_get_base_type (image))
{
case GIMP_RGB: return ALPHA;
case GIMP_CMYK: return ALPHA_C;
case GIMP_GRAY: return ALPHA_G;
case GIMP_INDEXED: return ALPHA_I;
}
@@ -3695,6 +3739,14 @@ gimp_image_get_active_mask (GimpImage *image)
mask |= (private->active[ALPHA]) ? GIMP_COMPONENT_MASK_ALPHA : 0;
break;
case GIMP_CMYK:
mask |= (private->active[CYAN]) ? GIMP_COMPONENT_MASK_RED : 0;
mask |= (private->active[MAGENTA]) ? GIMP_COMPONENT_MASK_GREEN : 0;
mask |= (private->active[YELLOW]) ? GIMP_COMPONENT_MASK_BLUE : 0;
mask |= (private->active[KEY]) ? GIMP_COMPONENT_MASK_ALPHA : 0;
mask |= (private->active[ALPHA_C]) ? GIMP_COMPONENT_MASK_ALPHA_CMYK : 0;
break;
case GIMP_GRAY:
case GIMP_INDEXED:
mask |= (private->active[GRAY]) ? GIMP_COMPONENT_MASK_RED : 0;
@@ -3729,7 +3781,10 @@ gimp_image_set_component_visible (GimpImage *image,
{
GimpComponentMask mask;
mask = ~gimp_image_get_visible_mask (image) & GIMP_COMPONENT_MASK_ALL;
if (gimp_image_get_base_type (image) == GIMP_CMYK)
mask = ~gimp_image_get_visible_mask (image) & GIMP_COMPONENT_MASK_CMYK_ALL;
else
mask = ~gimp_image_get_visible_mask (image) & GIMP_COMPONENT_MASK_ALL;
gegl_node_set (private->visible_mask,
"mask", mask,
@@ -3795,6 +3850,14 @@ gimp_image_get_visible_mask (GimpImage *image)
mask |= (private->visible[ALPHA]) ? GIMP_COMPONENT_MASK_ALPHA : 0;
break;
case GIMP_CMYK:
mask |= (private->visible[CYAN]) ? GIMP_COMPONENT_MASK_RED : 0;
mask |= (private->visible[MAGENTA]) ? GIMP_COMPONENT_MASK_GREEN : 0;
mask |= (private->visible[YELLOW]) ? GIMP_COMPONENT_MASK_BLUE : 0;
mask |= (private->visible[KEY]) ? GIMP_COMPONENT_MASK_ALPHA : 0;
mask |= (private->visible[ALPHA_C]) ? GIMP_COMPONENT_MASK_ALPHA_CMYK : 0;
break;
case GIMP_GRAY:
case GIMP_INDEXED:
mask |= (private->visible[GRAY]) ? GIMP_COMPONENT_MASK_RED : 0;

View File

@@ -176,6 +176,24 @@ color_profile_dialog_new (ColorProfileDialogType dialog_type,
dest_label = _("Convert to");
break;
case COLOR_PROFILE_DIALOG_CONVERT_TO_CMYK:
dialog =
gimp_viewable_dialog_new (g_list_prepend (NULL, image), context,
_("CMYK Conversion"),
"gimp-image-convert-cmyk",
GIMP_ICON_CONVERT_CMYK,
_("Convert Image to CMYK"),
parent,
gimp_standard_help_func,
GIMP_HELP_IMAGE_CONVERT_CMYK,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("C_onvert"), GTK_RESPONSE_OK,
NULL);
dest_label = _("Convert to");
break;
case COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY:
dialog =
gimp_viewable_dialog_new (g_list_prepend (NULL, image), context,
@@ -272,7 +290,8 @@ color_profile_dialog_new (ColorProfileDialogType dialog_type,
color_profile_dest_changed (private->combo, private);
if (dialog_type == COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE)
if (dialog_type == COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE ||
dialog_type == COLOR_PROFILE_DIALOG_CONVERT_TO_CMYK)
{
GtkWidget *vbox;
GtkWidget *hbox;
@@ -354,6 +373,10 @@ color_profile_combo_box_new (ProfileDialog *private)
base_type = GIMP_RGB;
break;
case COLOR_PROFILE_DIALOG_CONVERT_TO_CMYK:
base_type = GIMP_CMYK;
break;
case COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY:
base_type = GIMP_GRAY;
break;
@@ -458,6 +481,11 @@ color_profile_dest_changed (GtkWidget *combo,
{
GimpColorProfile *dest_profile = NULL;
GFile *file;
GtkWidget *convert_button;
convert_button =
gtk_dialog_get_widget_for_response (GTK_DIALOG (private->dialog),
GTK_RESPONSE_OK);
file = gimp_color_profile_combo_box_get_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo));
@@ -485,10 +513,16 @@ color_profile_dest_changed (GtkWidget *combo,
C_("profile", "None"));
}
gtk_widget_set_sensitive (convert_button, TRUE);
if (dest_profile)
{
gimp_color_profile_view_set_profile (GIMP_COLOR_PROFILE_VIEW (private->dest_view),
dest_profile);
g_object_unref (dest_profile);
}
else
{
if (private->dialog_type == COLOR_PROFILE_DIALOG_CONVERT_TO_CMYK)
gtk_widget_set_sensitive (convert_button, FALSE);
}
}

View File

@@ -26,6 +26,7 @@ typedef enum
COLOR_PROFILE_DIALOG_ASSIGN_PROFILE,
COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE,
COLOR_PROFILE_DIALOG_CONVERT_TO_RGB,
COLOR_PROFILE_DIALOG_CONVERT_TO_CMYK,
COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY,
COLOR_PROFILE_DIALOG_SELECT_SOFTPROOF_PROFILE
} ColorProfileDialogType;

View File

@@ -85,7 +85,15 @@ color_profile_import_dialog_run (GimpImage *image,
src_profile = gimp_image_get_color_profile (image);
*dest_profile = gimp_image_get_builtin_color_profile (image);
if (gimp_image_get_base_type (image) == GIMP_GRAY)
if (gimp_image_get_base_type (image) == GIMP_CMYK)
{
frame_title = _("Convert the image to the built-in CMYK color profile?");
pref_profile = gimp_color_config_get_cmyk_color_profile (image->gimp->config->color_management, NULL);
if (pref_profile && gimp_color_profile_is_equal (pref_profile, *dest_profile))
g_clear_object (&pref_profile);
}
else if (gimp_image_get_base_type (image) == GIMP_GRAY)
{
frame_title = _("Convert the image to the built-in grayscale color profile?");
@@ -157,7 +165,9 @@ color_profile_import_dialog_run (GimpImage *image,
if (pref_profile)
{
if (gimp_image_get_base_type (image) == GIMP_GRAY)
if (gimp_image_get_base_type (image) == GIMP_CMYK)
frame_title = _("Convert the image to the preferred CMYK color profile?");
else if (gimp_image_get_base_type (image) == GIMP_GRAY)
frame_title = _("Convert the image to the preferred grayscale color profile?");
else
frame_title = _("Convert the image to the preferred RGB color profile?");

View File

@@ -63,6 +63,18 @@ gimp_babl_format_get_image_type (const Babl *format)
{
return GIMP_RGBA_IMAGE;
}
else if (! strcmp (name, "CMYK") ||
! strcmp (name, "cmyk"))
{
return GIMP_CMYK_IMAGE;
}
else if (! strcmp (name, "CMYKA") ||
! strcmp (name, "cmykA") ||
! strcmp (name, "CaMaYaKaA") ||
! strcmp (name, "camayakaA"))
{
return GIMP_CMYKA_IMAGE;
}
else if (babl_format_is_palette (format))
{
if (babl_format_has_alpha (format))

View File

@@ -219,6 +219,32 @@ babl_descriptions[] =
{ "R'G'B'A double", N_("RGB-alpha") },
{ "R~G~B~A double", N_("RGB-alpha") },
{ "CMYK u8", N_("CMYK") },
{ "cmyk u8", N_("CMYK") },
{ "CMYK u16", N_("CMYK") },
{ "cmyk u16", N_("CMYK") },
{ "CMYK u32", N_("CMYK") },
{ "cmyk u32", N_("CMYK") },
{ "CMYK half", N_("CMYK") },
{ "cmyk half", N_("CMYK") },
{ "CMYK float", N_("CMYK") },
{ "cmyk float", N_("CMYK") },
{ "CMYK double", N_("CMYK") },
{ "cmyk double", N_("CMYK") },
{ "CMYKA u8", N_("CMYK-alpha") },
{ "cmykA u8", N_("CMYK-alpha") },
{ "CMYKA u16", N_("CMYK-alpha") },
{ "cmykA u16", N_("CMYK-alpha") },
{ "CMYKA u32", N_("CMYK-alpha") },
{ "cmykA u32", N_("CMYK-alpha") },
{ "CMYKA half", N_("CMYK-alpha") },
{ "cmykA half", N_("CMYK-alpha") },
{ "CMYKA float", N_("CMYK-alpha") },
{ "cmykA float", N_("CMYK-alpha") },
{ "CMYKA double", N_("CMYK-alpha") },
{ "cmykA double", N_("CMYK-alpha") },
{ "Y u8", N_("Grayscale") },
{ "Y' u8", N_("Grayscale") },
{ "Y~ u8", N_("Grayscale") },
@@ -314,6 +340,58 @@ babl_descriptions[] =
{ "B' double", N_("Blue component") },
{ "B~ double", N_("Blue component") },
{ "Cyan u8", N_("Cyan component") },
{ "cyan u8", N_("Cyan component") },
{ "Cyan u16", N_("Cyan component") },
{ "cyan u16", N_("Cyan component") },
{ "Cyan u32", N_("Cyan component") },
{ "cyan u32", N_("Cyan component") },
{ "Cyan half", N_("Cyan component") },
{ "cyan half", N_("Cyan component") },
{ "Cyan float", N_("Cyan component") },
{ "cyan float", N_("Cyan component") },
{ "Cyan double", N_("Cyan component") },
{ "cyan double", N_("Cyan component") },
{ "Magenta u8", N_("Magenta component") },
{ "magenta u8", N_("Magenta component") },
{ "Magenta u16", N_("Magenta component") },
{ "magenta u16", N_("Magenta component") },
{ "Magenta u32", N_("Magenta component") },
{ "magenta u32", N_("Magenta component") },
{ "Magenta half", N_("Magenta component") },
{ "magenta half", N_("Magenta component") },
{ "Magenta float", N_("Magenta component") },
{ "magenta float", N_("Magenta component") },
{ "Magenta double", N_("Magenta component") },
{ "magenta double", N_("Magenta component") },
{ "Yellow u8", N_("Yellow component") },
{ "yellow u8", N_("Yellow component") },
{ "Yellow u16", N_("Yellow component") },
{ "yellow u16", N_("Yellow component") },
{ "Yellow u32", N_("Yellow component") },
{ "yellow u32", N_("Yellow component") },
{ "Yellow half", N_("Yellow component") },
{ "yellow half", N_("Yellow component") },
{ "Yellow float", N_("Yellow component") },
{ "yellow float", N_("Yellow component") },
{ "Yellow double", N_("Yellow component") },
{ "yellow double", N_("Yellow component") },
{ "Key u8", N_("Key component") },
{ "key u8", N_("Key component") },
{ "Key u16", N_("Key component") },
{ "key u16", N_("Key component") },
{ "Key u32", N_("Key component") },
{ "key u32", N_("Key component") },
{ "Key half", N_("Key component") },
{ "key half", N_("Key component") },
{ "Key float", N_("Key component") },
{ "key float", N_("Key component") },
{ "Key double", N_("Key component") },
{ "key double", N_("Key component") },
{ "A u8", N_("Alpha component") },
{ "A u16", N_("Alpha component") },
{ "A u32", N_("Alpha component") },
@@ -446,6 +524,10 @@ gimp_babl_format_get_color_profile (const Babl *format)
base_type = GIMP_RGB;
break;
case GIMP_CMYK:
base_type = GIMP_CMYK;
break;
case GIMP_GRAY:
base_type = GIMP_GRAY;
break;
@@ -505,6 +587,15 @@ gimp_babl_format_get_base_type (const Babl *format)
{
return GIMP_GRAY;
}
else if (! strcmp (name, "CMYK") ||
! strcmp (name, "cmyk") ||
! strcmp (name, "CMYKA") ||
! strcmp (name, "cmykA") ||
! strcmp (name, "CaMaYaKaA") ||
! strcmp (name, "camayakaA"))
{
return GIMP_CMYK;
}
else if (! strcmp (name, "RGB") ||
! strcmp (name, "R'G'B'") ||
! strcmp (name, "R~G~B~") ||
@@ -619,10 +710,16 @@ gimp_babl_format_get_trc (const Babl *format)
name = babl_get_name (babl_format_get_model (format));
if (! strcmp (name, "Y") ||
! strcmp (name, "YA") ||
! strcmp (name, "RGB") ||
! strcmp (name, "RGBA") ||
if (! strcmp (name, "Y") ||
! strcmp (name, "YA") ||
! strcmp (name, "CMYK") ||
! strcmp (name, "cmyk") ||
! strcmp (name, "CMYKA") ||
! strcmp (name, "cmykA") ||
! strcmp (name, "CaMaYaKaA") ||
! strcmp (name, "camayakaA") ||
! strcmp (name, "RGB") ||
! strcmp (name, "RGBA") ||
! strcmp (name, "RaGaBaA"))
{
return GIMP_TRC_LINEAR;
@@ -803,6 +900,7 @@ gimp_babl_is_valid (GimpImageBaseType base_type,
switch (base_type)
{
case GIMP_RGB:
case GIMP_CMYK:
case GIMP_GRAY:
return TRUE;
@@ -963,6 +1061,62 @@ gimp_babl_format (GimpImageBaseType base_type,
}
break;
case GIMP_CMYK:
switch (precision)
{
case GIMP_PRECISION_U8_LINEAR:
case GIMP_PRECISION_U8_NON_LINEAR:
case GIMP_PRECISION_U8_PERCEPTUAL:
if (with_alpha)
return babl_format_with_space ("CMYKA u8", space);
else
return babl_format_with_space ("CMYK u8", space);
case GIMP_PRECISION_U16_LINEAR:
case GIMP_PRECISION_U16_NON_LINEAR:
case GIMP_PRECISION_U16_PERCEPTUAL:
if (with_alpha)
return babl_format_with_space ("CMYKA u16", space);
else
return babl_format_with_space ("CMYK u16", space);
case GIMP_PRECISION_U32_LINEAR:
case GIMP_PRECISION_U32_NON_LINEAR:
case GIMP_PRECISION_U32_PERCEPTUAL:
if (with_alpha)
return babl_format_with_space ("CMYKA u32", space);
else
return babl_format_with_space ("CMYK u32", space);
case GIMP_PRECISION_HALF_LINEAR:
case GIMP_PRECISION_HALF_NON_LINEAR:
case GIMP_PRECISION_HALF_PERCEPTUAL:
if (with_alpha)
return babl_format_with_space ("CMYKA half", space);
else
return babl_format_with_space ("CMYK half", space);
case GIMP_PRECISION_FLOAT_LINEAR:
case GIMP_PRECISION_FLOAT_NON_LINEAR:
case GIMP_PRECISION_FLOAT_PERCEPTUAL:
if (with_alpha)
return babl_format_with_space ("CMYKA float", space);
else
return babl_format_with_space ("CMYK float", space);
case GIMP_PRECISION_DOUBLE_LINEAR:
case GIMP_PRECISION_DOUBLE_NON_LINEAR:
case GIMP_PRECISION_DOUBLE_PERCEPTUAL:
if (with_alpha)
return babl_format_with_space ("CMYKA double", space);
else
return babl_format_with_space ("CMYK double", space);
default:
break;
}
break;
case GIMP_GRAY:
switch (precision)
{
@@ -1334,6 +1488,100 @@ gimp_babl_component_format (GimpImageBaseType base_type,
}
break;
case GIMP_CMYK:
switch (precision)
{
case GIMP_PRECISION_U8_LINEAR:
case GIMP_PRECISION_U8_NON_LINEAR:
case GIMP_PRECISION_U8_PERCEPTUAL:
switch (index)
{
case 0: return babl_format ("Cyan u8");
case 1: return babl_format ("Magenta u8");
case 2: return babl_format ("Yellow u8");
case 3: return babl_format ("Key u8");
case 4: return babl_format ("A u8");
default:
break;
}
break;
case GIMP_PRECISION_U16_LINEAR:
case GIMP_PRECISION_U16_NON_LINEAR:
case GIMP_PRECISION_U16_PERCEPTUAL:
switch (index)
{
case 0: return babl_format ("Cyan u16");
case 1: return babl_format ("Magenta u16");
case 2: return babl_format ("Yellow u16");
case 3: return babl_format ("Key u16");
case 4: return babl_format ("A u16");
default:
break;
}
break;
case GIMP_PRECISION_U32_LINEAR:
case GIMP_PRECISION_U32_NON_LINEAR:
case GIMP_PRECISION_U32_PERCEPTUAL:
switch (index)
{
case 0: return babl_format ("Cyan u32");
case 1: return babl_format ("Magenta u32");
case 2: return babl_format ("Yellow u32");
case 3: return babl_format ("Key u32");
case 4: return babl_format ("A u32");
default:
break;
}
break;
case GIMP_PRECISION_HALF_LINEAR:
case GIMP_PRECISION_HALF_NON_LINEAR:
case GIMP_PRECISION_HALF_PERCEPTUAL:
switch (index)
{
case 0: return babl_format ("Cyan half");
case 1: return babl_format ("Magenta half");
case 2: return babl_format ("Yellow half");
case 3: return babl_format ("Key half");
case 4: return babl_format ("A half");
default:
break;
}
break;
case GIMP_PRECISION_FLOAT_LINEAR:
case GIMP_PRECISION_FLOAT_NON_LINEAR:
case GIMP_PRECISION_FLOAT_PERCEPTUAL:
switch (index)
{
case 0: return babl_format ("Cyan float");
case 1: return babl_format ("Magenta float");
case 2: return babl_format ("Yellow float");
case 3: return babl_format ("Key float");
case 4: return babl_format ("A float");
default:
break;
}
break;
case GIMP_PRECISION_DOUBLE_LINEAR:
case GIMP_PRECISION_DOUBLE_NON_LINEAR:
case GIMP_PRECISION_DOUBLE_PERCEPTUAL:
switch (index)
{
case 0: return babl_format ("Cyan double");
case 1: return babl_format ("Magenta double");
case 2: return babl_format ("Yellow double");
case 3: return babl_format ("Key double");
case 4: return babl_format ("A double");
default:
break;
}
break;
}
case GIMP_GRAY:
switch (precision)
{

View File

@@ -36,7 +36,8 @@ enum
{
PROP_0,
PROP_MASK,
PROP_ALPHA
PROP_ALPHA,
PROP_IMAGE_FORMAT,
};
@@ -114,6 +115,11 @@ gimp_operation_mask_components_class_init (GimpOperationMaskComponentsClass *kla
(GParamFlags) (
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT)));
g_object_class_install_property (object_class, PROP_IMAGE_FORMAT,
g_param_spec_pointer ("image-format",
"Image format", NULL,
G_PARAM_READWRITE));
}
static void
@@ -139,6 +145,10 @@ gimp_operation_mask_components_get_property (GObject *object,
g_value_set_double (value, self->alpha);
break;
case PROP_IMAGE_FORMAT:
g_value_set_pointer (value, (gpointer) self->image_format);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -163,6 +173,10 @@ gimp_operation_mask_components_set_property (GObject *object,
self->alpha = g_value_get_double (value);
break;
case PROP_IMAGE_FORMAT:
self->image_format = (const Babl *) g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -189,8 +203,11 @@ get_alpha_value (const Babl *format,
}
DEF_CASE ( 4, guint8)
DEF_CASE ( 5, guint8)
DEF_CASE ( 8, guint16)
DEF_CASE (10, guint16)
DEF_CASE (16, guint32)
DEF_CASE (20, guint32)
#undef DEF_CASE
@@ -213,12 +230,14 @@ struct ProcessGeneric
T *out = (T *) out_buf;
gint i;
gint c;
gint pix_range = 4;
gint alpha_index = 3;
if (aux_buf)
{
const T *in[4];
const T *in[pix_range];
for (c = 0; c < 4; c++)
for (c = 0; c < pix_range; c++)
{
if (mask & (1 << c))
in[c] = (const T *) aux_buf + c;
@@ -228,14 +247,14 @@ struct ProcessGeneric
for (i = 0; i < n; i++)
{
for (c = 0; c < 4; c++)
for (c = 0; c < pix_range; c++)
{
out[c] = *in[c];
in[c] += 4;
in[c] += pix_range;
}
out += 4;
out += pix_range;
}
}
else
@@ -244,7 +263,7 @@ struct ProcessGeneric
for (i = 0; i < n; i++)
{
for (c = 0; c < 3; c++)
for (c = 0; c < alpha_index; c++)
{
if (mask & (1 << c))
out[c] = 0;
@@ -252,13 +271,13 @@ struct ProcessGeneric
out[c] = in[c];
}
if (mask & (1 << 3))
out[3] = alpha_value;
else
out[3] = in[3];
//if (mask & (1 << alpha_index))
//out[alpha_index] = alpha_value;
//else
out[alpha_index] = in[alpha_index];
in += 4;
out += 4;
in += pix_range;
out += pix_range;
}
}
}
@@ -331,7 +350,7 @@ struct Process<guint8>
out++;
}
}
else
/*else
{
guint32 alpha_mask = alpha_value << 24;
@@ -342,7 +361,7 @@ struct Process<guint8>
in++;
out++;
}
}
}*/
}
}
};
@@ -372,6 +391,8 @@ gimp_operation_mask_components_prepare (GeglOperation *operation)
const Babl *format;
const Babl *aux_format;
self->is_cmyk = FALSE;
format = gimp_operation_mask_components_get_format (gegl_operation_get_source_format (operation, "input"));
aux_format = gimp_operation_mask_components_get_format (gegl_operation_get_source_format (operation, "aux"));
@@ -382,6 +403,14 @@ gimp_operation_mask_components_prepare (GeglOperation *operation)
*/
format = aux_format;
if (self->image_format &&
babl_space_is_cmyk (babl_format_get_space (self->image_format)))
{
format = babl_format_with_space ("CMYK float",
babl_format_get_space (self->image_format));
self->is_cmyk = TRUE;
}
gegl_operation_set_format (operation, "input", format);
gegl_operation_set_format (operation, "aux", format);
gegl_operation_set_format (operation, "output", format);
@@ -431,7 +460,8 @@ gimp_operation_mask_components_get_bounding_box (GeglOperation *operation)
if (in_rect)
return *in_rect;
}
else if (self->mask == GIMP_COMPONENT_MASK_ALL)
else if ((self->mask == GIMP_COMPONENT_MASK_ALL && ! self->is_cmyk) ||
self->mask == GIMP_COMPONENT_MASK_CMYK_ALL)
{
if (aux_rect)
return *aux_rect;
@@ -463,7 +493,8 @@ gimp_operation_mask_components_parent_process (GeglOperation *operation,
return TRUE;
}
else if (self->mask == GIMP_COMPONENT_MASK_ALL)
else if ((self->mask == GIMP_COMPONENT_MASK_ALL && ! self->is_cmyk) ||
self->mask == GIMP_COMPONENT_MASK_CMYK_ALL)
{
GObject *aux = gegl_operation_context_get_object (context, "aux");
@@ -553,6 +584,22 @@ gimp_operation_mask_components_get_format (const Babl *input_format)
else if (! strcmp (type_name, "float"))
format = babl_format ("R'G'B'A float");
}
else if (! strcmp (model_name, "CMYK") ||
! strcmp (model_name, "cmyk") ||
! strcmp (model_name, "CMYKA") ||
! strcmp (model_name, "cmykA"))
{
if (! strcmp (type_name, "u8"))
format = babl_format ("CMYKA u8");
else if (! strcmp (type_name, "u16"))
format = babl_format ("CMYKA u16");
else if (! strcmp (type_name, "u32"))
format = babl_format ("CMYKA u32");
else if (! strcmp (type_name, "half"))
format = babl_format ("CMYKA half");
else if (! strcmp (type_name, "float"))
format = babl_format ("RGBA float");
}
}
if (! format)
@@ -580,14 +627,17 @@ gimp_operation_mask_components_process (const Babl *format,
switch (babl_format_get_bytes_per_pixel (format))
{
case 4:
case 5:
Process<guint8>::process (in, aux, out, n, mask, 0);
break;
case 8:
case 10:
Process<guint16>::process (in, aux, out, n, mask, 0);
break;
case 16:
case 20:
Process<guint32>::process (in, aux, out, n, mask, 0);
break;

View File

@@ -40,10 +40,12 @@ struct _GimpOperationMaskComponents
GimpComponentMask mask;
gdouble alpha;
const Babl *image_format;
guint32 alpha_value;
gpointer process;
const Babl *format;
gboolean is_cmyk;
};
struct _GimpOperationMaskComponentsClass

View File

@@ -797,6 +797,21 @@ gimp_color_frame_update (GimpColorFrame *frame)
/* TRANSLATORS: V for Value (grayscale) */
names[values_len++] = C_("Grayscale", "V:");
if (has_alpha)
/* TRANSLATORS: A for Alpha (color transparency) */
names[values_len++] = C_("Alpha channel", "A:");
}
else if (base_type == GIMP_CMYK)
{
/* TRANSLATORS: C for Cyan (CMYK) */
names[values_len++] = C_("CMYK", "C:");
/* TRANSLATORS: M for Magenta (CMYK) */
names[values_len++] = C_("CMYK", "M:");
/* TRANSLATORS: Y for Yellow (CMYK) */
names[values_len++] = C_("CMYK", "Y:");
/* TRANSLATORS: K for Key (CMYK) */
names[values_len++] = C_("CMYK", "K:");
if (has_alpha)
/* TRANSLATORS: A for Alpha (color transparency) */
names[values_len++] = C_("Alpha channel", "A:");

View File

@@ -346,6 +346,14 @@ gimp_component_editor_create_components (GimpComponentEditor *editor)
components[2] = GIMP_CHANNEL_BLUE;
break;
case GIMP_CMYK:
n_components = 4;
components[0] = GIMP_CHANNEL_CYAN;
components[1] = GIMP_CHANNEL_MAGENTA;
components[2] = GIMP_CHANNEL_YELLOW;
components[3] = GIMP_CHANNEL_KEY;
break;
case GIMP_GRAY:
n_components = 1;
components[0] = GIMP_CHANNEL_GRAY;

View File

@@ -145,6 +145,7 @@
#define GIMP_HELP_IMAGE_DIALOG "gimp-image-dialog"
#define GIMP_HELP_IMAGE_DUPLICATE "gimp-image-duplicate"
#define GIMP_HELP_IMAGE_CONVERT_RGB "gimp-image-convert-rgb"
#define GIMP_HELP_IMAGE_CONVERT_CMYK "gimp-image-convert-cmyk"
#define GIMP_HELP_IMAGE_CONVERT_GRAYSCALE "gimp-image-convert-grayscale"
#define GIMP_HELP_IMAGE_CONVERT_INDEXED "gimp-image-convert-indexed"
#define GIMP_HELP_IMAGE_CONVERT_U8 "gimp-image-convert-u8"

View File

@@ -474,6 +474,7 @@ gimp_image_prop_view_update (GimpImagePropView *view)
switch (type)
{
case GIMP_RGB:
case GIMP_CMYK:
case GIMP_GRAY:
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
g_snprintf (buf, sizeof (buf), "%s: %s", desc,

View File

@@ -178,6 +178,10 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
case GIMP_CHANNEL_RED: icon_name = GIMP_ICON_CHANNEL_RED; break;
case GIMP_CHANNEL_GREEN: icon_name = GIMP_ICON_CHANNEL_GREEN; break;
case GIMP_CHANNEL_BLUE: icon_name = GIMP_ICON_CHANNEL_BLUE; break;
case GIMP_CHANNEL_CYAN: icon_name = GIMP_ICON_CHANNEL_CYAN; break;
case GIMP_CHANNEL_MAGENTA: icon_name = GIMP_ICON_CHANNEL_MAGENTA; break;
case GIMP_CHANNEL_YELLOW: icon_name = GIMP_ICON_CHANNEL_YELLOW; break;
case GIMP_CHANNEL_KEY: icon_name = GIMP_ICON_CHANNEL_KEY; break;
case GIMP_CHANNEL_GRAY: icon_name = GIMP_ICON_CHANNEL_GRAY; break;
case GIMP_CHANNEL_INDEXED: icon_name = GIMP_ICON_CHANNEL_INDEXED; break;
case GIMP_CHANNEL_ALPHA: icon_name = GIMP_ICON_CHANNEL_ALPHA; break;

View File

@@ -2123,7 +2123,14 @@ gimp_color_profile_store_add_defaults (GimpColorProfileStore *store,
profile = gimp_babl_get_builtin_color_profile (base_type,
gimp_babl_trc (precision));
if (base_type == GIMP_GRAY)
if (base_type == GIMP_CMYK)
{
/* TODO: No default CMYK profile yet */
label = NULL;
profile = gimp_color_config_get_cmyk_color_profile (config, &my_error);
}
else if (base_type == GIMP_GRAY)
{
label = g_strdup_printf (_("Built-in grayscale (%s)"),
gimp_color_profile_get_label (profile));
@@ -2138,15 +2145,27 @@ gimp_color_profile_store_add_defaults (GimpColorProfileStore *store,
profile = gimp_color_config_get_rgb_color_profile (config, &my_error);
}
gimp_color_profile_store_add_file (store, NULL, label);
g_free (label);
if (label)
{
gimp_color_profile_store_add_file (store, NULL, label);
g_free (label);
}
if (profile)
{
gchar *path;
GFile *file;
if (base_type == GIMP_GRAY)
if (base_type == GIMP_CMYK)
{
g_object_get (config, "cmyk-profile", &path, NULL);
file = gimp_file_new_for_config_path (path, NULL);
g_free (path);
label = g_strdup_printf (_("Preferred CMYK (%s)"),
gimp_color_profile_get_label (profile));
}
else if (base_type == GIMP_GRAY)
{
g_object_get (config, "gray-profile", &path, NULL);
file = gimp_file_new_for_config_path (path, NULL);

View File

@@ -83,6 +83,9 @@ export_merge (GimpImage *image,
case GIMP_RGB:
layer_type = GIMP_RGBA_IMAGE;
break;
case GIMP_CMYK:
layer_type = GIMP_CMYKA_IMAGE;
break;
case GIMP_GRAY:
layer_type = GIMP_GRAYA_IMAGE;
break;
@@ -580,8 +583,9 @@ gimp_export_options_get_image (GimpExportOptions *options,
/* Get capabilities from ExportOptions */
g_object_get (options, "capabilities", &capabilities, NULL);
g_return_val_if_fail (capabilities & (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
g_return_val_if_fail (capabilities & (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_CMYK |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_BITMAP),
GIMP_EXPORT_IGNORE);
@@ -801,6 +805,32 @@ gimp_export_options_get_image (GimpExportOptions *options,
}
break;
case GIMP_CMYK:
if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_CMYK))
{
if ((capabilities & GIMP_EXPORT_CAN_HANDLE_RGB) &&
(capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED))
actions = g_slist_prepend (actions,
&export_action_convert_rgb_or_indexed);
else if ((capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED) &&
(capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY))
actions = g_slist_prepend (actions,
&export_action_convert_indexed_or_grayscale);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB)
actions = g_slist_prepend (actions,
&export_action_convert_rgb);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY)
actions = g_slist_prepend (actions,
&export_action_convert_grayscale);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED)
actions = g_slist_prepend (actions,
&export_action_convert_indexed);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP)
actions = g_slist_prepend (actions,
&export_action_convert_bitmap);
}
break;
case GIMP_GRAY:
if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY))
{

View File

@@ -156,6 +156,10 @@ gimp_channel_type_get_type (void)
{ GIMP_CHANNEL_RED, "GIMP_CHANNEL_RED", "red" },
{ GIMP_CHANNEL_GREEN, "GIMP_CHANNEL_GREEN", "green" },
{ GIMP_CHANNEL_BLUE, "GIMP_CHANNEL_BLUE", "blue" },
{ GIMP_CHANNEL_CYAN, "GIMP_CHANNEL_CYAN", "cyan" },
{ GIMP_CHANNEL_MAGENTA, "GIMP_CHANNEL_MAGENTA", "magenta" },
{ GIMP_CHANNEL_YELLOW, "GIMP_CHANNEL_YELLOW", "yellow" },
{ GIMP_CHANNEL_KEY, "GIMP_CHANNEL_KEY", "key" },
{ GIMP_CHANNEL_GRAY, "GIMP_CHANNEL_GRAY", "gray" },
{ GIMP_CHANNEL_INDEXED, "GIMP_CHANNEL_INDEXED", "indexed" },
{ GIMP_CHANNEL_ALPHA, "GIMP_CHANNEL_ALPHA", "alpha" },
@@ -167,6 +171,10 @@ gimp_channel_type_get_type (void)
{ GIMP_CHANNEL_RED, NC_("channel-type", "Red"), NULL },
{ GIMP_CHANNEL_GREEN, NC_("channel-type", "Green"), NULL },
{ GIMP_CHANNEL_BLUE, NC_("channel-type", "Blue"), NULL },
{ GIMP_CHANNEL_CYAN, NC_("channel-type", "Cyan"), NULL },
{ GIMP_CHANNEL_MAGENTA, NC_("channel-type", "Magenta"), NULL },
{ GIMP_CHANNEL_YELLOW, NC_("channel-type", "Yellow"), NULL },
{ GIMP_CHANNEL_KEY, NC_("channel-type", "Key"), NULL },
{ GIMP_CHANNEL_GRAY, NC_("channel-type", "Gray"), NULL },
{ GIMP_CHANNEL_INDEXED, NC_("channel-type", "Indexed"), NULL },
{ GIMP_CHANNEL_ALPHA, NC_("channel-type", "Alpha"), NULL },
@@ -854,6 +862,7 @@ gimp_image_base_type_get_type (void)
static const GEnumValue values[] =
{
{ GIMP_RGB, "GIMP_RGB", "rgb" },
{ GIMP_CMYK, "GIMP_CMYK", "cmyk" },
{ GIMP_GRAY, "GIMP_GRAY", "gray" },
{ GIMP_INDEXED, "GIMP_INDEXED", "indexed" },
{ 0, NULL, NULL }
@@ -862,6 +871,7 @@ gimp_image_base_type_get_type (void)
static const GimpEnumDesc descs[] =
{
{ GIMP_RGB, NC_("image-base-type", "RGB color"), NULL },
{ GIMP_CMYK, NC_("image-base-type", "CMYK color"), NULL },
{ GIMP_GRAY, NC_("image-base-type", "Grayscale"), NULL },
{ GIMP_INDEXED, NC_("image-base-type", "Indexed color"), NULL },
{ 0, NULL, NULL }
@@ -887,6 +897,8 @@ gimp_image_type_get_type (void)
{
{ GIMP_RGB_IMAGE, "GIMP_RGB_IMAGE", "rgb-image" },
{ GIMP_RGBA_IMAGE, "GIMP_RGBA_IMAGE", "rgba-image" },
{ GIMP_CMYK_IMAGE, "GIMP_CMYK_IMAGE", "cmyk-image" },
{ GIMP_CMYKA_IMAGE, "GIMP_CMYKA_IMAGE", "cmyka-image" },
{ GIMP_GRAY_IMAGE, "GIMP_GRAY_IMAGE", "gray-image" },
{ GIMP_GRAYA_IMAGE, "GIMP_GRAYA_IMAGE", "graya-image" },
{ GIMP_INDEXED_IMAGE, "GIMP_INDEXED_IMAGE", "indexed-image" },
@@ -898,6 +910,8 @@ gimp_image_type_get_type (void)
{
{ GIMP_RGB_IMAGE, NC_("image-type", "RGB"), NULL },
{ GIMP_RGBA_IMAGE, NC_("image-type", "RGB-alpha"), NULL },
{ GIMP_CMYK_IMAGE, NC_("image-type", "CMYK"), NULL },
{ GIMP_CMYKA_IMAGE, NC_("image-type", "CMYK-alpha"), NULL },
{ GIMP_GRAY_IMAGE, NC_("image-type", "Grayscale"), NULL },
{ GIMP_GRAYA_IMAGE, NC_("image-type", "Grayscale-alpha"), NULL },
{ GIMP_INDEXED_IMAGE, NC_("image-type", "Indexed"), NULL },
@@ -1918,6 +1932,7 @@ gimp_export_capabilities_get_type (void)
static const GFlagsValue values[] =
{
{ GIMP_EXPORT_CAN_HANDLE_RGB, "GIMP_EXPORT_CAN_HANDLE_RGB", "can-handle-rgb" },
{ GIMP_EXPORT_CAN_HANDLE_CMYK, "GIMP_EXPORT_CAN_HANDLE_CMYK", "can-handle-cmyk" },
{ GIMP_EXPORT_CAN_HANDLE_GRAY, "GIMP_EXPORT_CAN_HANDLE_GRAY", "can-handle-gray" },
{ GIMP_EXPORT_CAN_HANDLE_INDEXED, "GIMP_EXPORT_CAN_HANDLE_INDEXED", "can-handle-indexed" },
{ GIMP_EXPORT_CAN_HANDLE_BITMAP, "GIMP_EXPORT_CAN_HANDLE_BITMAP", "can-handle-bitmap" },
@@ -1934,6 +1949,7 @@ gimp_export_capabilities_get_type (void)
static const GimpFlagsDesc descs[] =
{
{ GIMP_EXPORT_CAN_HANDLE_RGB, "GIMP_EXPORT_CAN_HANDLE_RGB", NULL },
{ GIMP_EXPORT_CAN_HANDLE_CMYK, "GIMP_EXPORT_CAN_HANDLE_CMYK", NULL },
{ GIMP_EXPORT_CAN_HANDLE_GRAY, "GIMP_EXPORT_CAN_HANDLE_GRAY", NULL },
{ GIMP_EXPORT_CAN_HANDLE_INDEXED, "GIMP_EXPORT_CAN_HANDLE_INDEXED", NULL },
{ GIMP_EXPORT_CAN_HANDLE_BITMAP, "GIMP_EXPORT_CAN_HANDLE_BITMAP", NULL },

View File

@@ -128,6 +128,10 @@ typedef enum
* @GIMP_CHANNEL_RED: Red
* @GIMP_CHANNEL_GREEN: Green
* @GIMP_CHANNEL_BLUE: Blue
* @GIMP_CHANNEL_CYAN: Cyan
* @GIMP_CHANNEL_MAGENTA: Magenta
* @GIMP_CHANNEL_YELLOW: Yellow
* @GIMP_CHANNEL_KEY: Key
* @GIMP_CHANNEL_GRAY: Gray
* @GIMP_CHANNEL_INDEXED: Indexed
* @GIMP_CHANNEL_ALPHA: Alpha
@@ -143,6 +147,10 @@ typedef enum
GIMP_CHANNEL_RED, /*< desc="Red" >*/
GIMP_CHANNEL_GREEN, /*< desc="Green" >*/
GIMP_CHANNEL_BLUE, /*< desc="Blue" >*/
GIMP_CHANNEL_CYAN, /*< desc="Cyan" >*/
GIMP_CHANNEL_MAGENTA, /*< desc="Magenta" >*/
GIMP_CHANNEL_YELLOW, /*< desc="Yellow" >*/
GIMP_CHANNEL_KEY, /*< desc="Key" >*/
GIMP_CHANNEL_GRAY, /*< desc="Gray" >*/
GIMP_CHANNEL_INDEXED, /*< desc="Indexed" >*/
GIMP_CHANNEL_ALPHA /*< desc="Alpha" >*/
@@ -580,6 +588,7 @@ typedef enum
/**
* GimpImageBaseType:
* @GIMP_RGB: RGB color
* @GIMP_CMYK: CMYK color
* @GIMP_GRAY: Grayscale
* @GIMP_INDEXED: Indexed color
*
@@ -592,6 +601,7 @@ GType gimp_image_base_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_RGB, /*< desc="RGB color" >*/
GIMP_CMYK, /*< desc="CMYK color" >*/
GIMP_GRAY, /*< desc="Grayscale" >*/
GIMP_INDEXED /*< desc="Indexed color" >*/
} GimpImageBaseType;
@@ -601,6 +611,8 @@ typedef enum
* GimpImageType:
* @GIMP_RGB_IMAGE: RGB
* @GIMP_RGBA_IMAGE: RGB-alpha
* @GIMP_CMYK_IMAGE: CMYK
* @GIMP_CMYKA_IMAGE: CMYK-alpha
* @GIMP_GRAY_IMAGE: Grayscale
* @GIMP_GRAYA_IMAGE: Grayscale-alpha
* @GIMP_INDEXED_IMAGE: Indexed
@@ -616,6 +628,8 @@ typedef enum
{
GIMP_RGB_IMAGE, /*< desc="RGB" >*/
GIMP_RGBA_IMAGE, /*< desc="RGB-alpha" >*/
GIMP_CMYK_IMAGE, /*< desc="CMYK" >*/
GIMP_CMYKA_IMAGE, /*< desc="CMYK-alpha" >*/
GIMP_GRAY_IMAGE, /*< desc="Grayscale" >*/
GIMP_GRAYA_IMAGE, /*< desc="Grayscale-alpha" >*/
GIMP_INDEXED_IMAGE, /*< desc="Indexed" >*/
@@ -1304,6 +1318,7 @@ typedef enum
/**
* GimpExportCapabilities:
* @GIMP_EXPORT_CAN_HANDLE_RGB: Handles RGB images
* @GIMP_EXPORT_CAN_HANDLE_CMYK: Handles CMYK images
* @GIMP_EXPORT_CAN_HANDLE_GRAY: Handles grayscale images
* @GIMP_EXPORT_CAN_HANDLE_INDEXED: Handles indexed images
* @GIMP_EXPORT_CAN_HANDLE_BITMAP: Handles two-color indexed images
@@ -1324,16 +1339,17 @@ GType gimp_export_capabilities_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_EXPORT_CAN_HANDLE_RGB = 1 << 0,
GIMP_EXPORT_CAN_HANDLE_GRAY = 1 << 1,
GIMP_EXPORT_CAN_HANDLE_INDEXED = 1 << 2,
GIMP_EXPORT_CAN_HANDLE_BITMAP = 1 << 3,
GIMP_EXPORT_CAN_HANDLE_ALPHA = 1 << 4,
GIMP_EXPORT_CAN_HANDLE_LAYERS = 1 << 5,
GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION = 1 << 6,
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS = 1 << 7,
GIMP_EXPORT_CAN_HANDLE_LAYER_EFFECTS = 1 << 8,
GIMP_EXPORT_NEEDS_ALPHA = 1 << 9,
GIMP_EXPORT_NEEDS_CROP = 1 << 10
GIMP_EXPORT_CAN_HANDLE_CMYK = 1 << 1,
GIMP_EXPORT_CAN_HANDLE_GRAY = 1 << 2,
GIMP_EXPORT_CAN_HANDLE_INDEXED = 1 << 3,
GIMP_EXPORT_CAN_HANDLE_BITMAP = 1 << 4,
GIMP_EXPORT_CAN_HANDLE_ALPHA = 1 << 5,
GIMP_EXPORT_CAN_HANDLE_LAYERS = 1 << 6,
GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION = 1 << 7,
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS = 1 << 8,
GIMP_EXPORT_CAN_HANDLE_LAYER_EFFECTS = 1 << 9,
GIMP_EXPORT_NEEDS_ALPHA = 1 << 10,
GIMP_EXPORT_NEEDS_CROP = 1 << 11
} GimpExportCapabilities;

View File

@@ -116,10 +116,14 @@ G_BEGIN_DECLS
#define GIMP_ICON_CHANNEL "gimp-channel"
#define GIMP_ICON_CHANNEL_ALPHA "gimp-channel-alpha"
#define GIMP_ICON_CHANNEL_BLUE "gimp-channel-blue"
#define GIMP_ICON_CHANNEL_CYAN "gimp-channel-cyan"
#define GIMP_ICON_CHANNEL_GRAY "gimp-channel-gray"
#define GIMP_ICON_CHANNEL_GREEN "gimp-channel-green"
#define GIMP_ICON_CHANNEL_INDEXED "gimp-channel-indexed"
#define GIMP_ICON_CHANNEL_KEY "gimp-channel-key"
#define GIMP_ICON_CHANNEL_MAGENTA "gimp-channel-magenta"
#define GIMP_ICON_CHANNEL_RED "gimp-channel-red"
#define GIMP_ICON_CHANNEL_YELLOW "gimp-channel-yellow"
#define GIMP_ICON_CLOSE "gimp-close"
#define GIMP_ICON_CLOSE_ALL "gimp-close-all"
@@ -148,6 +152,7 @@ G_BEGIN_DECLS
#define GIMP_ICON_CONTROLLER_WHEEL "gimp-controller-wheel"
#define GIMP_ICON_CONVERT_RGB "gimp-convert-rgb"
#define GIMP_ICON_CONVERT_CMYK "gimp-convert-cmyk"
#define GIMP_ICON_CONVERT_GRAYSCALE "gimp-convert-grayscale"
#define GIMP_ICON_CONVERT_INDEXED "gimp-convert-indexed"
#define GIMP_ICON_CONVERT_PRECISION GIMP_ICON_CONVERT_RGB

View File

@@ -314,6 +314,7 @@
<submenu>
<attribute name="label" translatable="yes" context="image-action">_Mode</attribute>
<item><attribute name="action">app.image-convert-rgb</attribute></item>
<item><attribute name="action">app.image-convert-cmyk</attribute></item>
<item><attribute name="action">app.image-convert-grayscale</attribute></item>
<item><attribute name="action">app.image-convert-indexed</attribute></item>
</submenu>

View File

@@ -77,14 +77,20 @@ package Gimp::CodeGen::enums;
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_CHANNEL_RED GIMP_CHANNEL_GREEN
GIMP_CHANNEL_BLUE GIMP_CHANNEL_GRAY
GIMP_CHANNEL_BLUE GIMP_CHANNEL_CYAN
GIMP_CHANNEL_MAGENTA GIMP_CHANNEL_YELLOW
GIMP_CHANNEL_KEY GIMP_CHANNEL_GRAY
GIMP_CHANNEL_INDEXED GIMP_CHANNEL_ALPHA) ],
mapping => { GIMP_CHANNEL_RED => '0',
GIMP_CHANNEL_GREEN => '1',
GIMP_CHANNEL_BLUE => '2',
GIMP_CHANNEL_GRAY => '3',
GIMP_CHANNEL_INDEXED => '4',
GIMP_CHANNEL_ALPHA => '5' }
GIMP_CHANNEL_CYAN => '3',
GIMP_CHANNEL_MAGENTA => '4',
GIMP_CHANNEL_YELLOW => '5',
GIMP_CHANNEL_KEY => '6',
GIMP_CHANNEL_GRAY => '7',
GIMP_CHANNEL_INDEXED => '8',
GIMP_CHANNEL_ALPHA => '9' }
},
GimpCloneType =>
{ contig => 1,
@@ -281,23 +287,26 @@ package Gimp::CodeGen::enums;
GimpImageBaseType =>
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_RGB GIMP_GRAY GIMP_INDEXED) ],
symbols => [ qw(GIMP_RGB GIMP_CMYK GIMP_GRAY GIMP_INDEXED) ],
mapping => { GIMP_RGB => '0',
GIMP_GRAY => '1',
GIMP_INDEXED => '2' }
GIMP_CMYK => '1',
GIMP_GRAY => '2',
GIMP_INDEXED => '3' }
},
GimpImageType =>
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_RGB_IMAGE GIMP_RGBA_IMAGE GIMP_GRAY_IMAGE
GIMP_GRAYA_IMAGE GIMP_INDEXED_IMAGE
GIMP_INDEXEDA_IMAGE) ],
symbols => [ qw(GIMP_RGB_IMAGE GIMP_RGBA_IMAGE GIMP_CMYK_IMAGE
GIMP_CMYKA_IMAGE GIMP_GRAY_IMAGE GIMP_GRAYA_IMAGE
GIMP_INDEXED_IMAGE GIMP_INDEXEDA_IMAGE) ],
mapping => { GIMP_RGB_IMAGE => '0',
GIMP_RGBA_IMAGE => '1',
GIMP_GRAY_IMAGE => '2',
GIMP_GRAYA_IMAGE => '3',
GIMP_INDEXED_IMAGE => '4',
GIMP_INDEXEDA_IMAGE => '5' }
GIMP_CMYK_IMAGE => '2',
GIMP_CMYKA_IMAGE => '3',
GIMP_GRAY_IMAGE => '4',
GIMP_GRAYA_IMAGE => '5',
GIMP_INDEXED_IMAGE => '6',
GIMP_INDEXEDA_IMAGE => '7' }
},
GimpInkBlobType =>
{ contig => 1,
@@ -631,6 +640,7 @@ package Gimp::CodeGen::enums;
{ contig => 0,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_EXPORT_CAN_HANDLE_RGB
GIMP_EXPORT_CAN_HANDLE_CMYK
GIMP_EXPORT_CAN_HANDLE_GRAY
GIMP_EXPORT_CAN_HANDLE_INDEXED
GIMP_EXPORT_CAN_HANDLE_BITMAP
@@ -641,16 +651,17 @@ package Gimp::CodeGen::enums;
GIMP_EXPORT_CAN_HANDLE_LAYER_EFFECTS
GIMP_EXPORT_NEEDS_ALPHA GIMP_EXPORT_NEEDS_CROP) ],
mapping => { GIMP_EXPORT_CAN_HANDLE_RGB => '1 << 0',
GIMP_EXPORT_CAN_HANDLE_GRAY => '1 << 1',
GIMP_EXPORT_CAN_HANDLE_INDEXED => '1 << 2',
GIMP_EXPORT_CAN_HANDLE_BITMAP => '1 << 3',
GIMP_EXPORT_CAN_HANDLE_ALPHA => '1 << 4',
GIMP_EXPORT_CAN_HANDLE_LAYERS => '1 << 5',
GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION => '1 << 6',
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS => '1 << 7',
GIMP_EXPORT_CAN_HANDLE_LAYER_EFFECTS => '1 << 8',
GIMP_EXPORT_NEEDS_ALPHA => '1 << 9',
GIMP_EXPORT_NEEDS_CROP => '1 << 10' }
GIMP_EXPORT_CAN_HANDLE_CMYK => '1 << 1',
GIMP_EXPORT_CAN_HANDLE_GRAY => '1 << 2',
GIMP_EXPORT_CAN_HANDLE_INDEXED => '1 << 3',
GIMP_EXPORT_CAN_HANDLE_BITMAP => '1 << 4',
GIMP_EXPORT_CAN_HANDLE_ALPHA => '1 << 5',
GIMP_EXPORT_CAN_HANDLE_LAYERS => '1 << 6',
GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION => '1 << 7',
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS => '1 << 8',
GIMP_EXPORT_CAN_HANDLE_LAYER_EFFECTS => '1 << 9',
GIMP_EXPORT_NEEDS_ALPHA => '1 << 10',
GIMP_EXPORT_NEEDS_CROP => '1 << 11' }
},
GimpFileChooserAction =>
{ contig => 0,

View File

@@ -1010,74 +1010,6 @@ color_sycc_to_rgb (opj_image_t *img)
}
}
static gboolean
color_cmyk_to_rgb (opj_image_t *image)
{
float C, M, Y, K;
float sC, sM, sY, sK;
unsigned int w, h, max, i;
w = image->comps[0].w;
h = image->comps[0].h;
if ((image->numcomps < 4) ||
(image->comps[0].dx != image->comps[1].dx) ||
(image->comps[0].dx != image->comps[2].dx) ||
(image->comps[0].dx != image->comps[3].dx) ||
(image->comps[0].dy != image->comps[1].dy) ||
(image->comps[0].dy != image->comps[2].dy) ||
(image->comps[0].dy != image->comps[3].dy))
{
g_warning ("Cannot convert in color_cmyk_to_rgb()");
return FALSE;
}
max = w * h;
sC = 1.0f / (float) ((1 << image->comps[0].prec) - 1);
sM = 1.0f / (float) ((1 << image->comps[1].prec) - 1);
sY = 1.0f / (float) ((1 << image->comps[2].prec) - 1);
sK = 1.0f / (float) ((1 << image->comps[3].prec) - 1);
for (i = 0; i < max; ++i)
{
/* CMYK values from 0 to 1 */
C = (float) (image->comps[0].data[i]) * sC;
M = (float) (image->comps[1].data[i]) * sM;
Y = (float) (image->comps[2].data[i]) * sY;
K = (float) (image->comps[3].data[i]) * sK;
/* Invert all CMYK values */
C = 1.0f - C;
M = 1.0f - M;
Y = 1.0f - Y;
K = 1.0f - K;
/* CMYK -> RGB : RGB results from 0 to 255 */
image->comps[0].data[i] = (int) (255.0f * C * K); /* R */
image->comps[1].data[i] = (int) (255.0f * M * K); /* G */
image->comps[2].data[i] = (int) (255.0f * Y * K); /* B */
}
image->comps[0].prec = 8;
image->comps[1].prec = 8;
image->comps[2].prec = 8;
image->numcomps -= 1;
image->color_space = OPJ_CLRSPC_SRGB;
for (i = 3; i < image->numcomps; ++i)
{
memcpy(&(image->comps[i]), &(image->comps[i + 1]),
sizeof (image->comps[i]));
}
/* Restore the count so the OpenJPEG destroy function works
* properly */
image->numcomps += 1;
return TRUE;
}
/*
* This code has been adopted from sjpx_openjpeg.c of ghostscript
*/
@@ -1327,7 +1259,8 @@ export_dialog (GimpProcedure *procedure,
g_object_unref (cmyk_profile);
}
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), "cmyk-frame", NULL);
if (gimp_image_get_base_type (image) != GIMP_CMYK)
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), "cmyk-frame", NULL);
#endif
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), "resolution",
@@ -1534,18 +1467,6 @@ load_image (GimpProcedure *procedure,
goto out;
}
}
else if (image->color_space == OPJ_CLRSPC_CMYK)
{
if (! color_cmyk_to_rgb (image))
{
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Couldn't convert CMYK JP2 image in '%s' to RGB."),
gimp_file_get_utf8_name (file));
goto out;
}
num_components--;
}
else if (image->color_space == OPJ_CLRSPC_EYCC)
{
if (! color_esycc_to_rgb (image))
@@ -1557,8 +1478,16 @@ load_image (GimpProcedure *procedure,
}
}
/* At this point, the image should be converted to Gray or RGB. */
if (image->color_space == OPJ_CLRSPC_GRAY)
/* At this point, the image should be converted to CMYK, Gray, or RGB. */
if (image->color_space == OPJ_CLRSPC_CMYK)
{
base_type = GIMP_CMYK;
image_type = GIMP_CMYK_IMAGE;
if (num_components == 5)
image_type = GIMP_CMYKA_IMAGE;
}
else if (image->color_space == OPJ_CLRSPC_GRAY)
{
base_type = GIMP_GRAY;
image_type = GIMP_GRAY_IMAGE;
@@ -1745,6 +1674,26 @@ export_image (GFile *file,
color_space = OPJ_CLRSPC_SRGB;
break;
case GIMP_CMYKA_IMAGE:
if (precision == 8)
format = babl_format ("CMYKA u8");
else
format = babl_format ("CMYKA u16");
channels = 5;
color_space = OPJ_CLRSPC_CMYK;
break;
case GIMP_CMYK_IMAGE:
if (precision == 8)
format = babl_format ("CMYK u8");
else
format = babl_format ("CMYK u16");
channels = 4;
color_space = OPJ_CLRSPC_CMYK;
break;
case GIMP_GRAYA_IMAGE:
if (precision == 8)
format = babl_format ("Y'A u8");
@@ -1769,6 +1718,7 @@ export_image (GFile *file,
g_assert_not_reached ();
}
/* Used when non-CMYK images are exported as CMYK */
if (cmyk)
{
if (precision == 8)
@@ -1889,7 +1839,7 @@ export_image (GFile *file,
strncpy (parameters.cp_comment, comment, strlen (comment));
}
if (! cmyk)
if (! cmyk && gimp_image_get_base_type (image) != GIMP_CMYK)
parameters.tcp_mct = (channels >= 3) ? 1 : 0;
/* Quality of 0 is lossless */

View File

@@ -185,6 +185,7 @@ jpegxl_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_CMYK |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL, NULL);
@@ -248,8 +249,7 @@ jpegxl_create_procedure (GimpPlugIn *plug_in,
/* The Key data is stored in a separate extra
* channel. We combine the CMY values from the
* main image with the K values to create
* the final layer buffer.
*/
* the final layer buffer. */
static void
create_cmyk_layer (GimpImage *image,
GimpLayer *layer,
@@ -263,18 +263,14 @@ create_cmyk_layer (GimpImage *image,
const Babl *cmy_format = NULL;
const Babl *cmyka_format = NULL;
const Babl *key_format = NULL;
const Babl *rgb_format = NULL;
GeglBuffer *output_buffer;
GeglBuffer *picture_buffer;
GeglBuffer *cmy_buffer;
GeglBuffer *key_buffer;
GeglBufferIterator *iter;
GeglColor *fill_color = gegl_color_new ("rgba(0.0,0.0,0.0,0.0)");
gint width;
gint height;
gint n_components = 3;
const Babl *type = babl_type (type_format);
GString *rgb_type = g_string_new (NULL);
GString *cmy_type = g_string_new (NULL);
GString *cmyka_type = g_string_new (NULL);
@@ -287,11 +283,9 @@ create_cmyk_layer (GimpImage *image,
gimp_image_insert_layer (image, layer, NULL, 0);
output_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
g_string_printf (rgb_type, has_alpha ? "R'G'B'A %s" : "R'G'B' %s", type_format);
g_string_printf (cmy_type, "cmyk %s", type_format);
g_string_printf (cmyka_type, "cmykA %s", type_format);
rgb_format = babl_format (rgb_type->str);
cmy_format = babl_format_with_space ( cmy_type->str, space);
cmyka_format = babl_format_with_space ( cmyka_type->str, space);
@@ -307,10 +301,6 @@ create_cmyk_layer (GimpImage *image,
key_format = babl_format_with_space (babl_format_get_encoding (key_format),
space);
picture_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
has_alpha ? cmyka_format : cmy_format);
gegl_buffer_set_color (picture_buffer, NULL, fill_color);
cmy_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
babl_format_n (type, n_components));
key_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
@@ -322,11 +312,11 @@ create_cmyk_layer (GimpImage *image,
gegl_buffer_set (key_buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
key_format, key_data, GEGL_AUTO_ROWSTRIDE);
iter = gegl_buffer_iterator_new (picture_buffer,
iter = gegl_buffer_iterator_new (output_buffer,
GEGL_RECTANGLE (0, 0, width, height), 0,
has_alpha ? cmyka_format : cmy_format,
GEGL_BUFFER_READWRITE,
GEGL_ABYSS_NONE, 4);
GEGL_ABYSS_NONE, 3);
gegl_buffer_iterator_add (iter, cmy_buffer,
GEGL_RECTANGLE (0, 0, width, height), 0,
@@ -336,68 +326,48 @@ create_cmyk_layer (GimpImage *image,
GEGL_RECTANGLE (0, 0, width, height), 0,
key_format, GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
gegl_buffer_iterator_add (iter, output_buffer,
GEGL_RECTANGLE (0, 0, width, height), 0,
rgb_format, GEGL_BUFFER_READWRITE, GEGL_ABYSS_NONE);
while (gegl_buffer_iterator_next (iter))
{
guchar *pixel = iter->items[0].data;
guchar *output = iter->items[0].data;
guchar *cmy = iter->items[1].data;
guchar *k = iter->items[2].data;
guchar *output = iter->items[3].data;
gint length = iter->length;
gint row = length;
while (length--)
{
gint i;
for (i = 0; i < 3 * bit_depth; i++)
pixel[i] = cmy[i];
output[i] = cmy[i];
for (i = 0; i < bit_depth; i++)
pixel[i + (3 * bit_depth)] = k[i];
output[i + (3 * bit_depth)] = k[i];
if (has_alpha)
{
for (i = 0; i < bit_depth; i++)
pixel[i + (4 * bit_depth)] = cmy[i + (3 * bit_depth)];
}
pixel += 4 * bit_depth;
cmy += 3 * bit_depth;
k += bit_depth;
if (has_alpha)
{
pixel += bit_depth;
cmy += bit_depth;
output[i + (4 * bit_depth)] = cmy[i + (3 * bit_depth)];
}
output += 4 * bit_depth;
cmy += 3 * bit_depth;
k += bit_depth;
if (has_alpha)
{
cmy += bit_depth;
output += bit_depth;
}
}
/* Convert row from CMYK/A to RGB, due to layer buffers
* having a maximum of 4 colors currently */
pixel -= (4 * bit_depth) * row;
if (has_alpha)
pixel -= row * bit_depth;
output -= (4 * bit_depth) * row;
babl_process (babl_fish (has_alpha ? cmyka_format : cmy_format, rgb_format),
pixel, output, row);
}
g_object_unref (output_buffer);
g_object_unref (picture_buffer);
g_object_unref (cmy_buffer);
g_object_unref (key_buffer);
g_free (key_data);
g_string_free (cmyka_type, TRUE);
g_string_free (cmy_type, TRUE);
g_string_free (rgb_type, TRUE);
}
static GimpImage *
@@ -895,7 +865,7 @@ load_image (GFile *file,
}
else /* RGB or CMYK */
{
image = gimp_image_new_with_precision (basicinfo.xsize, basicinfo.ysize, GIMP_RGB,
image = gimp_image_new_with_precision (basicinfo.xsize, basicinfo.ysize, is_cmyk ? GIMP_CMYK: GIMP_RGB,
loadlinear ? precision_linear : precision_non_linear);
if (profile)
@@ -906,7 +876,7 @@ load_image (GFile *file,
}
else if (is_cmyk && gimp_color_profile_is_cmyk (profile))
{
gimp_image_set_simulation_profile (image, profile);
gimp_image_set_color_profile (image, profile);
space = gimp_color_profile_get_space (profile,
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
@@ -914,10 +884,16 @@ load_image (GFile *file,
}
}
layer = gimp_layer_new (image, "Background",
basicinfo.xsize, basicinfo.ysize,
(basicinfo.alpha_bits > 0) ? GIMP_RGBA_IMAGE : GIMP_RGB_IMAGE, 100,
gimp_image_get_default_new_layer_mode (image));
if (! is_cmyk)
layer = gimp_layer_new (image, "Background",
basicinfo.xsize, basicinfo.ysize,
(basicinfo.alpha_bits > 0) ? GIMP_RGBA_IMAGE : GIMP_RGB_IMAGE, 100,
gimp_image_get_default_new_layer_mode (image));
else
layer = gimp_layer_new (image, "Background",
basicinfo.xsize, basicinfo.ysize,
(basicinfo.alpha_bits > 0) ? GIMP_CMYKA_IMAGE : GIMP_CMYK_IMAGE, 100,
gimp_image_get_default_new_layer_mode (image));
}
if (is_cmyk)
@@ -1360,6 +1336,7 @@ export_image (GFile *file,
FILE *outfile;
GeglBuffer *buffer;
GimpImageType drawable_type;
GimpImageBaseType image_type;
gint drawable_width;
gint drawable_height;
@@ -1400,32 +1377,38 @@ export_image (GFile *file,
speed = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"speed");
if (cmyk)
{
/* CMYK is allways saved as lossless */
lossless = TRUE;
}
image_type = gimp_image_get_base_type (image);
drawable_type = gimp_drawable_type (drawable);
drawable_width = gimp_drawable_get_width (drawable);
drawable_height = gimp_drawable_get_height (drawable);
if (cmyk || image_type == GIMP_CMYK)
{
/* CMYK is always saved as lossless */
lossless = TRUE;
}
JxlEncoderInitBasicInfo(&output_info);
if (lossless)
{
output_info.uses_original_profile = JXL_TRUE;
if (cmyk)
if (cmyk && ! (image_type == GIMP_CMYK))
profile = gimp_image_get_simulation_profile (image);
else
profile = gimp_image_get_effective_color_profile (image);
/* Once we've retrieved either the simulation or color profile,
* the export code for CMYK is identicaly */
if (image_type == GIMP_CMYK)
cmyk = TRUE;
/* CMYK profile is required for export. If not assigned,
* disable CMYK flag and revert to RGB */
if (cmyk && ! profile)
{
cmyk = FALSE;
cmyk = FALSE;
profile = gimp_image_get_effective_color_profile (image);
}
@@ -1766,7 +1749,7 @@ export_image (GFile *file,
gimp_progress_update (0.5);
status = JxlEncoderAddImageFrame (encoder_options, &pixel_format,
(cmyk) ? cmy_buffer : picture_buffer,
cmyk ? cmy_buffer : picture_buffer,
buffer_size);
if (status != JXL_ENC_SUCCESS)
{
@@ -2033,10 +2016,18 @@ save_dialog (GimpImage *image,
-1);
gimp_help_set_help_data (profile_label,
_("Name of the color profile used for CMYK export."), NULL);
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
"cmyk-frame", "cmyk", FALSE,
"profile-label");
cmyk_profile = gimp_image_get_simulation_profile (image);
if (gimp_image_get_base_type (image) != GIMP_CMYK)
{
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
"cmyk-frame", "cmyk", FALSE,
"profile-label");
cmyk_profile = gimp_image_get_simulation_profile (image);
}
else
{
cmyk_profile = gimp_image_get_color_profile (image);
}
if (! cmyk_profile)
{
@@ -2068,12 +2059,19 @@ save_dialog (GimpImage *image,
cmyk_profile != NULL,
NULL, NULL, FALSE);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
"lossless", "compression",
"speed", "save-bit-depth",
"cmyk-frame",
"include-exif", "include-xmp",
NULL);
if (gimp_image_get_base_type (image) != GIMP_CMYK)
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
"lossless", "compression",
"speed", "save-bit-depth",
"cmyk-frame",
"include-exif", "include-xmp",
NULL);
else
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
"lossless", "compression",
"speed", "save-bit-depth",
"include-exif", "include-xmp",
NULL);
run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog));
@@ -2105,29 +2103,25 @@ jpegxl_export (GimpProcedure *procedure,
gimp_ui_init (PLUG_IN_BINARY);
if (! save_dialog (image, procedure, G_OBJECT (config)))
{
status = GIMP_PDB_CANCEL;
}
status = GIMP_PDB_CANCEL;
}
export = gimp_export_options_get_image (options, &image);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS)
{
GimpMetadataSaveFlags metadata_flags;
GimpMetadata *metadata = gimp_image_metadata_save_prepare (image, "image/jxl", &metadata_flags);
GimpMetadata *metadata = gimp_image_metadata_save_prepare (image,
"image/jxl",
&metadata_flags);
if (! export_image (file, config, image, drawables->data, metadata, &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
status = GIMP_PDB_EXECUTION_ERROR;
if (metadata)
{
g_object_unref (metadata);
}
g_object_unref (metadata);
}
if (export == GIMP_EXPORT_EXPORT)

View File

@@ -673,17 +673,18 @@ static GimpImage *
load_image (GFile *file,
GError **error)
{
GInputStream *input;
GeglBuffer *buffer;
GimpImage * volatile image = NULL;
GimpLayer *layer;
char buf[BUFLEN + 4]; /* buffer for random things like scanning */
PNMInfo *pnminfo;
PNMScanner *volatile scan;
gint ctr;
GimpPrecision precision;
gboolean is_pam = FALSE;
GimpImageType layer_type;
GInputStream *input;
GeglBuffer *buffer;
GimpImage * volatile image = NULL;
GimpImageBaseType image_type;
GimpLayer *layer;
GimpImageType layer_type;
char buf[BUFLEN + 4]; /* buffer for random things like scanning */
PNMInfo *pnminfo;
PNMScanner *volatile scan;
gint ctr;
GimpPrecision precision;
gboolean is_pam = FALSE;
gimp_progress_init_printf (_("Opening '%s'"),
g_file_get_parse_name (file));
@@ -815,9 +816,12 @@ load_image (GFile *file,
/* Create a new image of the proper size and associate the filename
* with it.
*/
image_type = (pnminfo->np >= 3) ? GIMP_RGB : GIMP_GRAY;
if (pnminfo->tupltype && ! strcmp (pnminfo->tupltype, "CMYK"))
image_type = GIMP_CMYK;
image = gimp_image_new_with_precision (pnminfo->xres, pnminfo->yres,
(pnminfo->np >= 3) ? GIMP_RGB : GIMP_GRAY,
precision);
image_type, precision);
switch (pnminfo->np)
{
@@ -841,6 +845,8 @@ load_image (GFile *file,
default:
layer_type = GIMP_GRAY_IMAGE;
}
if (image_type == GIMP_CMYK)
layer_type = GIMP_CMYK_IMAGE;
layer = gimp_layer_new (image, _("Background"), pnminfo->xres, pnminfo->yres,
layer_type, 100,
@@ -1393,6 +1399,10 @@ create_pam_header (const gchar **header_string,
*format = babl_format ("R'G'B'A u8");
*rowbufsize = xres * 4;
break;
/* TODO: Add CMYK export support for PAM */
default:
break;
}
*header_string = g_strdup_printf ("P7\n%s\nWIDTH %d\nHEIGHT %d\nDEPTH %d\n"

View File

@@ -204,39 +204,41 @@ export_image (GFile *file,
static struct jpeg_compress_struct cinfo;
static struct my_error_mgr jerr;
GimpImageType drawable_type;
GeglBuffer *buffer;
const gchar *encoding;
const Babl *format;
const Babl *space;
JpegSubsampling subsampling;
FILE * volatile outfile;
guchar *data;
guchar *src;
GimpColorProfile *profile = NULL;
GimpColorProfile *cmyk_profile = NULL;
GimpImageBaseType image_type;
GimpImageType drawable_type;
GeglBuffer *buffer;
const gchar *encoding;
const Babl *format;
const Babl *space;
JpegSubsampling subsampling;
FILE * volatile outfile;
guchar *data;
guchar *src;
GimpColorProfile *profile = NULL;
GimpColorProfile *cmyk_profile = NULL;
gboolean has_alpha;
gboolean out_linear = FALSE;
gint rowstride, yend;
gboolean has_alpha;
gboolean out_linear = FALSE;
gint rowstride;
gint yend;
gint quality;
gdouble dquality = 1.0;
gdouble smoothing;
gboolean optimize;
gboolean progressive;
gboolean cmyk;
gint subsmp;
gboolean baseline;
gint restart;
gint dct;
gboolean save_profile = TRUE;
gboolean save_comment;
gboolean use_orig_quality = FALSE;
gint orig_num_quant_tables = -1;
gboolean use_arithmetic_coding = FALSE;
gboolean use_restart = FALSE;
gchar *comment;
gint quality;
gdouble dquality = 1.0;
gdouble smoothing;
gboolean optimize;
gboolean progressive;
gboolean cmyk;
gint subsmp;
gboolean baseline;
gint restart;
gint dct;
gboolean save_profile = TRUE;
gboolean save_comment;
gboolean use_orig_quality = FALSE;
gint orig_num_quant_tables = -1;
gboolean use_arithmetic_coding = FALSE;
gboolean use_restart = FALSE;
gchar *comment;
g_object_get (config,
"quality", &dquality,
@@ -264,9 +266,11 @@ export_image (GFile *file,
quality = (gint) (dquality * 100.0 + 0.5);
image_type = gimp_image_get_base_type (image);
drawable_type = gimp_drawable_type (drawable);
buffer = gimp_drawable_get_buffer (drawable);
space = gimp_drawable_get_format (drawable);
space = gimp_drawable_get_format (drawable);
if (! preview)
gimp_progress_init_printf (_("Exporting '%s'"),
@@ -392,6 +396,14 @@ export_image (GFile *file,
encoding = "R'G'B' u8";
break;
case GIMP_CMYK_IMAGE:
/* # of color components per pixel */
cinfo.input_components = 4;
has_alpha = FALSE;
encoding = "cmyk u8";
break;
case GIMP_GRAY_IMAGE:
/* # of color components per pixel */
cinfo.input_components = 1;
@@ -414,6 +426,14 @@ export_image (GFile *file,
encoding = "R'G'B' u8";
break;
case GIMP_CMYKA_IMAGE:
/* # of color components per pixel */
cinfo.input_components = 5 - 1;
has_alpha = TRUE;
encoding = "cmyk u8";
break;
case GIMP_GRAYA_IMAGE:
/* # of color components per pixel (minus the GIMP alpha channel) */
cinfo.input_components = 2 - 1;
@@ -429,7 +449,8 @@ export_image (GFile *file,
return FALSE;
}
if (cmyk)
/* Used if non-CMYK images are exported as CMYK */
if (cmyk && image_type != GIMP_CMYK)
{
if (save_profile)
{
@@ -477,7 +498,7 @@ export_image (GFile *file,
cinfo.image_width = gegl_buffer_get_width (buffer);
cinfo.image_height = gegl_buffer_get_height (buffer);
/* colorspace of input image */
if (cmyk)
if (cmyk || image_type == GIMP_CMYK)
{
cinfo.input_components = 4;
cinfo.in_color_space = JCS_CMYK;
@@ -495,7 +516,7 @@ export_image (GFile *file,
*/
jpeg_set_defaults (&cinfo);
if (cmyk_profile)
if (cmyk_profile || image_type == GIMP_CMYK)
jpeg_set_colorspace (&cinfo, JCS_CMYK);
jpeg_set_quality (&cinfo, quality, baseline);
@@ -973,15 +994,26 @@ save_dialog (GimpProcedure *procedure,
/* Put options in two column form so the dialog fits on
* smaller screens. */
gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"options",
"quality",
"use-original-quality",
"preview-size",
"show-preview",
"progressive",
"cmyk-frame",
NULL);
if (gimp_image_get_base_type (image) != GIMP_CMYK)
gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"options",
"quality",
"use-original-quality",
"preview-size",
"show-preview",
"progressive",
"cmyk-frame",
NULL);
else
gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"options",
"quality",
"use-original-quality",
"preview-size",
"show-preview",
"progressive",
NULL);
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
"option-frame", "option-title", FALSE,
"options");

View File

@@ -75,7 +75,6 @@ load_image (GFile *file,
const Babl *space;
const gchar *encoding;
const gchar *layer_name = NULL;
GimpColorProfile *cmyk_profile = NULL;
gint tile_height;
gint i;
guchar *photoshop_data = NULL;
@@ -221,8 +220,8 @@ load_image (GFile *file,
case 4:
if (cinfo.out_color_space == JCS_CMYK)
{
image_type = GIMP_RGB;
layer_type = GIMP_RGB_IMAGE;
image_type = GIMP_CMYK;
layer_type = GIMP_CMYK_IMAGE;
break;
}
/*fallthrough*/
@@ -344,11 +343,16 @@ load_image (GFile *file,
profile = gimp_color_profile_new_from_icc_profile (icc_data,
icc_length,
NULL);
if (cinfo.out_color_space == JCS_CMYK)
if (profile)
{
/* don't attach the profile if we are transforming */
cmyk_profile = profile;
profile = NULL;
space = gimp_color_profile_get_space (profile,
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
error);
}
else
{
space = NULL;
}
if (profile)
@@ -387,17 +391,6 @@ load_image (GFile *file,
if (cinfo.out_color_space == JCS_CMYK)
{
encoding = "cmyk u8";
if (cmyk_profile)
{
space = gimp_color_profile_get_space (cmyk_profile,
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
error);
gimp_image_set_simulation_profile (image, cmyk_profile);
}
else
{
space = NULL;
}
}
else
{
@@ -415,7 +408,6 @@ load_image (GFile *file,
else
encoding = "Y' u16";
}
space = gimp_drawable_get_format (GIMP_DRAWABLE (layer));
}
format = babl_format_with_space (encoding, space);
@@ -514,7 +506,6 @@ load_image (GFile *file,
finish:
g_clear_object (&cmyk_profile);
/* Step 8: Release JPEG decompression object */
/* This is an important step since it will release a good deal of memory. */
@@ -749,7 +740,7 @@ load_thumbnail_image (GFile *file,
case 4:
if (cinfo.out_color_space == JCS_CMYK)
{
*type = GIMP_RGB_IMAGE;
*type = GIMP_CMYK_IMAGE;
break;
}
/*fallthrough*/

View File

@@ -199,7 +199,8 @@ jpeg_create_procedure (GimpPlugIn *plug_in,
"jpg,jpeg,jpe");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_CMYK |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL, NULL);

View File

@@ -528,6 +528,8 @@ gimpBaseTypeToPsdMode (GimpImageBaseType gimpBaseType)
{
case GIMP_RGB:
return 3; /* RGB */
case GIMP_CMYK:
return 4; /* CMYK */
case GIMP_GRAY:
return 1; /* Grayscale */
case GIMP_INDEXED:
@@ -556,6 +558,8 @@ nChansLayer (gint gimpBaseType,
{
case GIMP_RGB:
return 3 + incAlpha + incMask; /* R,G,B & Alpha & Mask (if any) */
case GIMP_CMYK:
return 4 + incAlpha + incMask; /* C,M,Y,K & Alpha & Mask (if any) */
case GIMP_GRAY:
return 1 + incAlpha + incMask; /* G & Alpha & Mask (if any) */
case GIMP_INDEXED:
@@ -603,6 +607,7 @@ save_header (GOutputStream *output,
PSDImageData.image_height, PSDImageData.image_width,
PSDImageData.baseType, PSDImageData.nChannels);
/* If export a non-CMYK image as CMYK */
if (options->cmyk)
{
nChannels =
@@ -739,7 +744,7 @@ save_resources (GOutputStream *output,
/* --------------- Write Channel names --------------- */
if (! options->cmyk)
if (! options->cmyk && gimp_image_get_base_type (image) != GIMP_CMYK)
{
if (PSDImageData.nChannels > 0 ||
gimp_drawable_has_alpha (GIMP_DRAWABLE (PSDImageData.merged_layer)))
@@ -1013,7 +1018,7 @@ save_resources (GOutputStream *output,
{
GimpColorProfile *profile = NULL;
if (options->cmyk)
if (options->cmyk && gimp_image_get_base_type (image) != GIMP_CMYK)
{
profile = gimp_image_get_simulation_profile (image);
@@ -1491,8 +1496,7 @@ save_layer_and_mask (GOutputStream *output,
hasMask);
/* Manually set channels to 4 or 5 when export as CMYK;
* Can be removed once CMYK channels are accessible in GIMP
*/
* Can be removed once CMYK channels are accessible in GIMP */
if (options->cmyk)
{
nChannelsLayer =
@@ -2258,7 +2262,7 @@ export_image (GFile *file,
IFDBG(1) g_debug ("Function: export_image");
if (resource_options.cmyk)
if (resource_options.cmyk || gimp_image_get_base_type (image) == GIMP_CMYK)
resource_options.duotone = FALSE;
max_dim = (! resource_options.psb) ? 30000 : 300000;
@@ -2452,6 +2456,14 @@ get_pixel_format (GimpDrawable *drawable)
model = "Y'A";
break;
case GIMP_CMYK_IMAGE:
model = "cmyk";
break;
case GIMP_CMYKA_IMAGE:
model = "cmykA";
break;
case GIMP_RGB_IMAGE:
model = "R'G'B'";
break;
@@ -2793,7 +2805,7 @@ save_dialog (GimpImage *image,
"cmyk-frame",
"duotone-frame",
NULL);
else
else if (gimp_image_get_base_type (image) != GIMP_CMYK)
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
"cmyk-frame",
NULL);

View File

@@ -1183,14 +1183,7 @@ load_resource_1039 (const PSDimageres *res_a,
NULL);
if (profile)
{
if (img_a->color_mode == PSD_CMYK &&
gimp_color_profile_is_cmyk (profile))
{
img_a->cmyk_profile = profile;
/* Store CMYK profile in GimpImage if attached */
gimp_image_set_simulation_profile (image, img_a->cmyk_profile);
}
else if (img_a->color_mode == PSD_LAB)
if (img_a->color_mode == PSD_LAB)
{
g_debug ("LAB color profile ignored.");
g_object_unref (profile);

View File

@@ -472,6 +472,10 @@ load_image_metadata (GFile *file,
img_a.color_mode = PSD_RGB;
break;
case GIMP_CMYK:
img_a.color_mode = PSD_CMYK;
break;
case GIMP_GRAY:
img_a.color_mode = PSD_GRAYSCALE;
break;
@@ -1585,8 +1589,11 @@ create_gimp_image (PSDimage *img_a,
img_a->base_type = GIMP_INDEXED;
break;
case PSD_LAB:
case PSD_CMYK:
img_a->base_type = GIMP_CMYK;
break;
case PSD_LAB:
case PSD_RGB:
img_a->base_type = GIMP_RGB;
break;
@@ -1605,7 +1612,7 @@ create_gimp_image (PSDimage *img_a,
break;
case 16:
if (img_a->color_mode == PSD_CMYK || img_a->color_mode == PSD_LAB)
if (img_a->color_mode == PSD_LAB)
precision = GIMP_PRECISION_FLOAT_NON_LINEAR;
else
precision = GIMP_PRECISION_U16_NON_LINEAR;
@@ -1613,7 +1620,7 @@ create_gimp_image (PSDimage *img_a,
case 8:
case 1:
if (img_a->color_mode == PSD_CMYK || img_a->color_mode == PSD_LAB)
if (img_a->color_mode == PSD_LAB)
precision = GIMP_PRECISION_FLOAT_NON_LINEAR;
else
precision = GIMP_PRECISION_U8_NON_LINEAR;
@@ -1715,46 +1722,6 @@ add_image_resources (GimpImage *image,
return 0;
}
static guchar *
psd_convert_cmyk_to_srgb (PSDimage *img_a,
guchar *dst,
guchar *src,
gint width,
gint height,
gboolean alpha,
GError **error)
{
const Babl *fish = NULL;
const Babl *base_format = NULL;
const Babl *space = NULL;
if (img_a->cmyk_profile &&
gimp_color_profile_is_cmyk (img_a->cmyk_profile))
{
/* If no CMYK profile attached, babl_format_with_space ()
* will ignore the NULL space value and process the image
* as if it were just using babl_format ()
*/
space = gimp_color_profile_get_space (img_a->cmyk_profile,
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
error);
}
if (img_a->bps == 8)
base_format = babl_format_with_space (alpha ? "cmykA u8" : "cmyk u8", space);
else
base_format = babl_format_with_space (alpha ? "cmykA u16" : "cmyk u16", space);
if (! alpha)
fish = babl_fish (base_format, "R'G'B' float");
else
fish = babl_fish (base_format, "R'G'B'A float");
babl_process (fish, src, dst, width * height);
return (guchar*) dst;
}
static guchar *
psd_convert_lab_to_srgb (PSDimage *img_a,
guchar *dst,
@@ -2591,11 +2558,9 @@ add_layers (GimpImage *image,
gint src_step = bps;
gint dst_step = bps * base_channels;
if (img_a->color_mode == PSD_CMYK || img_a->color_mode == PSD_LAB)
{
dst0 = gegl_scratch_alloc (base_channels * bps *
iter->length);
}
if (img_a->color_mode == PSD_LAB)
dst0 = gegl_scratch_alloc (base_channels * bps *
iter->length);
for (cidx = 0; cidx < base_channels; ++cidx)
{
@@ -2633,17 +2598,7 @@ add_layers (GimpImage *image,
}
}
if (img_a->color_mode == PSD_CMYK)
{
psd_convert_cmyk_to_srgb (
img_a,
iter->items[0].data, dst0,
roi->width, roi->height,
alpha, error);
gegl_scratch_free (dst0);
}
else if (img_a->color_mode == PSD_LAB)
if (img_a->color_mode == PSD_LAB)
{
psd_convert_lab_to_srgb (
img_a,
@@ -3108,20 +3063,7 @@ add_merged_image (GimpImage *image,
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
if (img_a->color_mode == PSD_CMYK)
{
guchar *dst0;
dst0 = g_malloc (base_channels * layer_size * sizeof(float));
psd_convert_cmyk_to_srgb (img_a,
dst0, pixels,
img_a->columns, img_a->rows,
img_a->transparency || alpha_channel,
error);
g_free (pixels);
pixels = dst0;
}
else if (img_a->color_mode == PSD_LAB)
if (img_a->color_mode == PSD_LAB)
{
guchar *dst0;
@@ -3143,9 +3085,6 @@ add_merged_image (GimpImage *image,
alpha_channel),
pixels, GEGL_AUTO_ROWSTRIDE);
if (img_a->color_mode == PSD_CMYK)
img_a->color_mode = PSD_RGB;
/* Merged image data is blended against white. Unblend it. */
if (img_a->transparency)
{
@@ -3397,6 +3336,10 @@ get_gimp_image_type (GimpImageBaseType image_base_type,
switch (image_base_type)
{
case GIMP_CMYK:
image_type = (alpha) ? GIMP_CMYKA_IMAGE : GIMP_CMYK_IMAGE;
break;
case GIMP_GRAY:
image_type = (alpha) ? GIMP_GRAYA_IMAGE : GIMP_GRAY_IMAGE;
break;
@@ -3708,6 +3651,44 @@ get_layer_format (PSDimage *img_a,
switch (get_gimp_image_type (img_a->base_type, alpha))
{
case GIMP_CMYK_IMAGE:
switch (img_a->bps)
{
/* Photoshop does not support 32 bpc CMYK images */
case 16:
format = babl_format ("cmyk u16");
break;
case 8:
case 1:
format = babl_format ("cmyk u8");
break;
default:
return NULL;
break;
}
break;
case GIMP_CMYKA_IMAGE:
switch (img_a->bps)
{
case 16:
format = babl_format ("cmykA u16");
break;
case 8:
case 1:
format = babl_format ("cmykA u8");
break;
default:
return NULL;
break;
}
break;
case GIMP_GRAY_IMAGE:
switch (img_a->bps)
{
@@ -3761,13 +3742,13 @@ get_layer_format (PSDimage *img_a,
break;
case 16:
format = babl_format ((img_a->color_mode == PSD_CMYK || img_a->color_mode == PSD_LAB) ?
format = babl_format ((img_a->color_mode == PSD_LAB) ?
"R'G'B' float" : "R'G'B' u16");
break;
case 8:
case 1:
format = babl_format ((img_a->color_mode == PSD_CMYK || img_a->color_mode == PSD_LAB) ?
format = babl_format ((img_a->color_mode == PSD_LAB) ?
"R'G'B' float" : "R'G'B' u8");
break;
@@ -3785,13 +3766,13 @@ get_layer_format (PSDimage *img_a,
break;
case 16:
format = babl_format ((img_a->color_mode == PSD_CMYK || img_a->color_mode == PSD_LAB) ?
format = babl_format ((img_a->color_mode == PSD_LAB) ?
"R'G'B'A float" : "R'G'B'A u16");
break;
case 8:
case 1:
format = babl_format ((img_a->color_mode == PSD_CMYK || img_a->color_mode == PSD_LAB) ?
format = babl_format ((img_a->color_mode == PSD_LAB) ?
"R'G'B'A float" : "R'G'B'A u8");
break;

View File

@@ -264,6 +264,7 @@ psd_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_CMYK |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA |

View File

@@ -279,51 +279,52 @@ save_layer (TIFF *tif,
gboolean out_linear,
GError **error)
{
gboolean status = FALSE;
gushort red[256];
gushort grn[256];
gushort blu[256];
gint cols, rows, row, i;
glong rowsperstrip;
gushort compression;
gushort extra_samples[1];
gboolean alpha;
gshort predictor;
gshort photometric;
const Babl *format;
const Babl *type;
gshort samplesperpixel;
gshort bitspersample;
gshort sampleformat;
gint bytesperrow;
guchar *src = NULL;
guchar *data = NULL;
GimpPalette *palette;
guchar *cmap;
gint num_colors;
gint success;
GimpImageType drawable_type;
GeglBuffer *buffer = NULL;
gint tile_height;
gint y, yend;
gboolean is_bw = FALSE;
gboolean invert = TRUE;
const guchar bw_map[] = { 0, 0, 0, 255, 255, 255 };
const guchar wb_map[] = { 255, 255, 255, 0, 0, 0 };
gchar *layer_name = NULL;
const gdouble progress_base = (gdouble) page / (gdouble) num_pages;
const gdouble progress_fraction = 1.0 / (gdouble) num_pages;
gdouble xresolution;
gdouble yresolution;
gushort save_unit = RESUNIT_INCH;
gint offset_x, offset_y;
gint config_compression;
gchar *config_comment;
gboolean config_save_comment;
gboolean config_save_transp_pixels;
gboolean config_save_geotiff_tags;
gboolean config_save_profile;
gboolean config_cmyk;
gboolean status = FALSE;
gushort red[256];
gushort grn[256];
gushort blu[256];
gint cols, rows, row, i;
glong rowsperstrip;
gushort compression;
gushort extra_samples[1];
gboolean alpha;
gshort predictor;
gshort photometric;
const Babl *format;
const Babl *type;
gshort samplesperpixel;
gshort bitspersample;
gshort sampleformat;
gint bytesperrow;
guchar *src = NULL;
guchar *data = NULL;
GimpPalette *palette;
guchar *cmap;
gint num_colors;
gint success;
GimpImageBaseType image_type;
GimpImageType drawable_type;
GeglBuffer *buffer = NULL;
gint tile_height;
gint y, yend;
gboolean is_bw = FALSE;
gboolean invert = TRUE;
const guchar bw_map[] = { 0, 0, 0, 255, 255, 255 };
const guchar wb_map[] = { 255, 255, 255, 0, 0, 0 };
gchar *layer_name = NULL;
const gdouble progress_base = (gdouble) page / (gdouble) num_pages;
const gdouble progress_fraction = 1.0 / (gdouble) num_pages;
gdouble xresolution;
gdouble yresolution;
gushort save_unit = RESUNIT_INCH;
gint offset_x, offset_y;
gint config_compression;
gchar *config_comment;
gboolean config_save_comment;
gboolean config_save_transp_pixels;
gboolean config_save_geotiff_tags;
gboolean config_save_profile;
gboolean config_cmyk;
g_object_get (config,
"gimp-comment", &config_comment,
@@ -351,6 +352,7 @@ save_layer (TIFF *tif,
tile_height = gimp_tile_height ();
rowsperstrip = tile_height;
image_type = gimp_image_get_base_type (image);
drawable_type = gimp_drawable_type (GIMP_DRAWABLE (layer));
buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
@@ -446,6 +448,21 @@ save_layer (TIFF *tif,
}
break;
case GIMP_CMYK_IMAGE:
predictor = 2;
samplesperpixel = 4;
photometric = PHOTOMETRIC_SEPARATED;
alpha = FALSE;
format = babl_format_new (babl_model ("CMYK"),
type,
babl_component ("Cyan"),
babl_component ("Magenta"),
babl_component ("Yellow"),
babl_component ("Key"),
NULL);
break;
case GIMP_GRAY_IMAGE:
samplesperpixel = 1;
photometric = PHOTOMETRIC_MINISBLACK;
@@ -519,6 +536,22 @@ save_layer (TIFF *tif,
}
break;
case GIMP_CMYKA_IMAGE:
predictor = 2;
samplesperpixel = 5;
photometric = PHOTOMETRIC_SEPARATED;
alpha = TRUE;
format = babl_format_new (babl_model ("CMYKA"),
type,
babl_component ("Cyan"),
babl_component ("Magenta"),
babl_component ("Yellow"),
babl_component ("Key"),
babl_component ("A"),
NULL);
break;
case GIMP_GRAYA_IMAGE:
samplesperpixel = 2;
photometric = PHOTOMETRIC_MINISBLACK;
@@ -611,6 +644,7 @@ save_layer (TIFF *tif,
goto out;
}
/* Used if exporting a non-CMYK image as CMYK */
if (config_cmyk)
{
if (alpha)
@@ -669,7 +703,9 @@ save_layer (TIFF *tif,
}
#ifdef TIFFTAG_ICCPROFILE
if (config_save_profile || config_cmyk)
if (config_save_profile ||
config_cmyk ||
image_type == GIMP_CMYK)
{
const guint8 *icc_data = NULL;
gsize icc_length;
@@ -677,7 +713,7 @@ save_layer (TIFF *tif,
GimpColorProfile *cmyk_profile = NULL;
profile = gimp_image_get_effective_color_profile (orig_image);
if (config_cmyk)
if (config_cmyk && (image_type != GIMP_CMYK))
cmyk_profile = gimp_image_get_simulation_profile (image);
/* If a non-CMYK profile was assigned as the simulation profile,
@@ -700,7 +736,7 @@ save_layer (TIFF *tif,
}
#endif
/* Set CMYK Properties */
/* Set CMYK Properties if exporting a non-CMYK image as CMYK */
if (config_cmyk)
{
photometric = PHOTOMETRIC_SEPARATED;
@@ -848,6 +884,8 @@ save_layer (TIFF *tif,
}
break;
case GIMP_CMYK_IMAGE:
case GIMP_CMYKA_IMAGE:
case GIMP_GRAY_IMAGE:
case GIMP_GRAYA_IMAGE:
case GIMP_RGB_IMAGE:
@@ -1049,6 +1087,7 @@ export_image (GFile *file,
{
TIFF *tif = NULL;
const Babl *space = NULL;
GimpImageBaseType image_type;
gboolean status = FALSE;
gboolean out_linear = FALSE;
gint32 num_layers;
@@ -1070,8 +1109,9 @@ export_image (GFile *file,
"cmyk", &config_cmyk,
NULL);
layers = gimp_image_list_layers (image);
layers = g_list_reverse (layers);
image_type = gimp_image_get_base_type (image);
layers = gimp_image_list_layers (image);
layers = g_list_reverse (layers);
num_layers = g_list_length (layers);
gimp_progress_init_printf (_("Exporting '%s'"),
@@ -1094,7 +1134,7 @@ export_image (GFile *file,
GimpColorProfile *profile;
GError *error = NULL;
if (config_cmyk)
if (config_cmyk && (image_type != GIMP_CMYK))
{
profile = gimp_image_get_simulation_profile (image);
@@ -1114,7 +1154,7 @@ export_image (GFile *file,
if (profile)
space = gimp_color_profile_get_space (profile,
config_cmyk ?
(config_cmyk && (image_type != GIMP_CMYK)) ?
gimp_image_get_simulation_intent (image) :
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
&error);
@@ -1316,11 +1356,19 @@ save_dialog (GimpImage *image,
-1);
gimp_help_set_help_data (profile_label,
_("Name of the color profile used for CMYK export."), NULL);
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
"cmyk-frame", "cmyk", FALSE,
"profile-label");
cmyk_profile = gimp_image_get_simulation_profile (image);
if (gimp_image_get_base_type (image) != GIMP_CMYK)
{
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
"cmyk-frame", "cmyk", FALSE,
"profile-label");
cmyk_profile = gimp_image_get_simulation_profile (image);
}
else
{
cmyk_profile = gimp_image_get_color_profile (image);
}
if (cmyk_profile)
{
gchar *label_text;
@@ -1357,7 +1405,6 @@ save_dialog (GimpImage *image,
"bigtiff",
"layers-frame",
"save-transparent-pixels",
"cmyk-frame",
NULL);
else
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
@@ -1365,9 +1412,12 @@ save_dialog (GimpImage *image,
"bigtiff",
"layers-frame",
"save-transparent-pixels",
"cmyk-frame",
NULL);
if (gimp_image_get_base_type (image) != GIMP_CMYK)
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
"cmyk-frame", NULL);
compression = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config), "compression");
if (! is_monochrome)

View File

@@ -1041,7 +1041,8 @@ load_image (GimpProcedure *procedure,
break;
case PHOTOMETRIC_SEPARATED:
layer_type = alpha ? GIMP_RGBA_IMAGE : GIMP_RGB_IMAGE;
image_type = GIMP_CMYK;
layer_type = alpha ? GIMP_CMYKA_IMAGE : GIMP_CMYK_IMAGE;
/* It's possible that a CMYK image might not have an
* attached profile, so we'll check for it and set up
* space accordingly
@@ -1180,14 +1181,7 @@ load_image (GimpProcedure *procedure,
images_list = g_list_prepend (images_list, *image);
}
/* attach CMYK profile to GimpImage if applicable */
if (profile && gimp_color_profile_is_cmyk (profile))
{
gimp_image_set_simulation_profile (*image, profile);
g_clear_object (&profile);
}
/* attach non-CMYK color profile */
/* attach color profile */
if (profile)
{
if (pages.target == GIMP_PAGE_SELECTOR_TARGET_IMAGES || profile == first_profile)

View File

@@ -480,6 +480,7 @@ export_edit_options (GimpProcedure *procedure,
else
{
capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_CMYK |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);