Issue #701 - Add the ability to embed the GIMP built-in sRGB profile...

...upon exporting an image

Step 1: make it configurable just like "Export EXIF" etc.

app, libgimp: add "export-color-profile" config option

Add it to the preferences dialog, and pass it on to plug-ins in the
GPConfig message. Add gimp_export_color_profile() to libgimp.

Nothing uses this yet.
This commit is contained in:
Michael Natterer 2018-06-18 02:19:41 +02:00
parent e0f46d1dc9
commit 8c9c091021
10 changed files with 70 additions and 19 deletions

View File

@ -110,6 +110,7 @@ enum
PROP_IMPORT_PROMOTE_DITHER,
PROP_IMPORT_ADD_ALPHA,
PROP_IMPORT_RAW_PLUG_IN,
PROP_EXPORT_COLOR_PROFILE,
PROP_EXPORT_METADATA_EXIF,
PROP_EXPORT_METADATA_XMP,
PROP_EXPORT_METADATA_IPTC,
@ -641,6 +642,13 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_COLOR_PROFILE,
"export-color-profile",
"Export Color Profile",
EXPORT_COLOR_PROFILE_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_METADATA_EXIF,
"export-metadata-exif",
"Export Exif metadata",
@ -967,6 +975,9 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->import_raw_plug_in);
core_config->import_raw_plug_in = g_value_dup_string (value);
break;
case PROP_EXPORT_COLOR_PROFILE:
core_config->export_color_profile = g_value_get_boolean (value);
break;
case PROP_EXPORT_METADATA_EXIF:
core_config->export_metadata_exif = g_value_get_boolean (value);
break;
@ -1166,6 +1177,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_IMPORT_RAW_PLUG_IN:
g_value_set_string (value, core_config->import_raw_plug_in);
break;
case PROP_EXPORT_COLOR_PROFILE:
g_value_set_boolean (value, core_config->export_color_profile);
break;
case PROP_EXPORT_METADATA_EXIF:
g_value_set_boolean (value, core_config->export_metadata_exif);
break;

View File

@ -95,6 +95,7 @@ struct _GimpCoreConfig
gboolean import_promote_dither;
gboolean import_add_alpha;
gchar *import_raw_plug_in;
gboolean export_color_profile;
gboolean export_metadata_exif;
gboolean export_metadata_xmp;
gboolean export_metadata_iptc;

View File

@ -204,6 +204,9 @@ _("Add an alpha channel to all layers of imported images.")
#define IMPORT_RAW_PLUG_IN_BLURB \
_("Which plug-in to use for importing raw digital camera files.")
#define EXPORT_COLOR_PROFILE_BLURB \
_("Export the image's color profile by default.")
#define EXPORT_METADATA_EXIF_BLURB \
_("Export Exif metadata by default.")

View File

@ -1476,6 +1476,9 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Export Policies"),
GTK_CONTAINER (vbox), FALSE);
button = prefs_check_button_add (object, "export-color-profile",
_("Export the image's color profile by default"),
GTK_BOX (vbox2));
button = prefs_check_button_add (object, "export-metadata-exif",
_("Export Exif metadata by default when available"),
GTK_BOX (vbox2));

View File

@ -207,6 +207,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
gui_config->show_help_button);
config.use_cpu_accel = manager->gimp->use_cpu_accel;
config.use_opencl = gegl_config->use_opencl;
config.export_profile = core_config->export_color_profile;
config.export_exif = core_config->export_metadata_exif;
config.export_xmp = core_config->export_metadata_xmp;
config.export_iptc = core_config->export_metadata_iptc;

View File

@ -215,6 +215,7 @@ static gint _shm_ID = -1;
static guchar *_shm_addr = NULL;
static const gdouble _gamma_val = 2.2;
static gboolean _show_help_button = TRUE;
static gboolean _export_profile = FALSE;
static gboolean _export_exif = FALSE;
static gboolean _export_xmp = FALSE;
static gboolean _export_iptc = FALSE;
@ -1416,6 +1417,22 @@ gimp_show_help_button (void)
return _show_help_button;
}
/**
* gimp_export_color_profile:
*
* Returns whether file plug-ins should default to exporting the
* image's color profile.
*
* Return value: TRUE if preferences are set to export the color profile.
*
* Since: 2.10.4
**/
gboolean
gimp_export_color_profile (void)
{
return _export_profile;
}
/**
* gimp_export_exif:
*
@ -2155,6 +2172,7 @@ gimp_config (GPConfig *config)
_check_size = config->check_size;
_check_type = config->check_type;
_show_help_button = config->show_help_button ? TRUE : FALSE;
_export_profile = config->export_profile ? TRUE : FALSE;
_export_exif = config->export_exif ? TRUE : FALSE;
_export_xmp = config->export_xmp ? TRUE : FALSE;
_export_iptc = config->export_iptc ? TRUE : FALSE;

View File

@ -253,6 +253,7 @@ EXPORTS
gimp_enums_init
gimp_eraser
gimp_eraser_default
gimp_export_color_profile
gimp_export_exif
gimp_export_iptc
gimp_export_xmp

View File

@ -314,25 +314,26 @@ GimpPDBStatusType gimp_get_pdb_status (void);
/* Return various constants given by the GIMP core at plug-in config time.
*/
guint gimp_tile_width (void) G_GNUC_CONST;
guint gimp_tile_height (void) G_GNUC_CONST;
gint gimp_shm_ID (void) G_GNUC_CONST;
guchar * gimp_shm_addr (void) G_GNUC_CONST;
gdouble gimp_gamma (void) G_GNUC_CONST;
gboolean gimp_show_help_button (void) G_GNUC_CONST;
gboolean gimp_export_exif (void) G_GNUC_CONST;
gboolean gimp_export_xmp (void) G_GNUC_CONST;
gboolean gimp_export_iptc (void) G_GNUC_CONST;
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
gint32 gimp_default_display (void) G_GNUC_CONST;
const gchar * gimp_wm_class (void) G_GNUC_CONST;
const gchar * gimp_display_name (void) G_GNUC_CONST;
gint gimp_monitor_number (void) G_GNUC_CONST;
guint32 gimp_user_time (void) G_GNUC_CONST;
const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
guint gimp_tile_width (void) G_GNUC_CONST;
guint gimp_tile_height (void) G_GNUC_CONST;
gint gimp_shm_ID (void) G_GNUC_CONST;
guchar * gimp_shm_addr (void) G_GNUC_CONST;
gdouble gimp_gamma (void) G_GNUC_CONST;
gboolean gimp_show_help_button (void) G_GNUC_CONST;
gboolean gimp_export_color_profile (void) G_GNUC_CONST;
gboolean gimp_export_exif (void) G_GNUC_CONST;
gboolean gimp_export_xmp (void) G_GNUC_CONST;
gboolean gimp_export_iptc (void) G_GNUC_CONST;
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
gint32 gimp_default_display (void) G_GNUC_CONST;
const gchar * gimp_wm_class (void) G_GNUC_CONST;
const gchar * gimp_display_name (void) G_GNUC_CONST;
gint gimp_monitor_number (void) G_GNUC_CONST;
guint32 gimp_user_time (void) G_GNUC_CONST;
const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
const gchar * gimp_get_progname (void) G_GNUC_CONST;
const gchar * gimp_get_progname (void) G_GNUC_CONST;
G_END_DECLS

View File

@ -500,6 +500,10 @@ _gp_config_read (GIOChannel *channel,
(guint8 *) &config->use_opencl, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_int8 (channel,
(guint8 *) &config->export_profile, 1,
user_data))
goto cleanup;
if (! _gimp_wire_read_int8 (channel,
(guint8 *) &config->export_exif, 1,
user_data))
@ -584,6 +588,10 @@ _gp_config_write (GIOChannel *channel,
(const guint8 *) &config->use_opencl, 1,
user_data))
return;
if (! _gimp_wire_write_int8 (channel,
(const guint8 *) &config->export_profile, 1,
user_data))
return;
if (! _gimp_wire_write_int8 (channel,
(const guint8 *) &config->export_exif, 1,
user_data))

View File

@ -26,7 +26,7 @@ G_BEGIN_DECLS
/* Increment every time the protocol changes
*/
#define GIMP_PROTOCOL_VERSION 0x0100
#define GIMP_PROTOCOL_VERSION 0x0101
enum
@ -69,6 +69,7 @@ struct _GPConfig
gint8 show_help_button;
gint8 use_cpu_accel;
gint8 use_opencl;
gint8 export_profile;
gint8 export_exif;
gint8 export_xmp;
gint8 export_iptc;