Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Add flag GIMP_METADATA_LOAD_COLORSPACE which defaults to TRUE, and in gimp_image_metadata_load_finish(), assign AdobeRGB to the image if Exif.Iop.InteroperabilityIndex says "R03". This is most likely very incomplete because there are quite some other colorspace tags in various parts of the image metadata.
This commit is contained in:
@ -175,6 +175,32 @@ gimp_image_metadata_load_finish (gint32 image_ID,
|
||||
metadata, interactive);
|
||||
}
|
||||
|
||||
if (flags & GIMP_METADATA_LOAD_COLORSPACE)
|
||||
{
|
||||
gchar *value;
|
||||
|
||||
value = gexiv2_metadata_get_tag_interpreted_string (metadata,
|
||||
"Exif.Iop.InteroperabilityIndex");
|
||||
|
||||
if (! g_strcmp0 (value, "R03"))
|
||||
{
|
||||
GimpColorProfile *profile = gimp_image_get_color_profile (image_ID);
|
||||
|
||||
if (! profile)
|
||||
{
|
||||
/* honor the R03 InteroperabilityIndex only if the
|
||||
* image didn't contain an ICC profile
|
||||
*/
|
||||
profile = gimp_color_profile_new_adobe_rgb ();
|
||||
gimp_image_set_color_profile (image_ID, profile);
|
||||
}
|
||||
|
||||
g_object_unref (profile);
|
||||
}
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
gimp_image_set_metadata (image_ID, metadata);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ typedef enum
|
||||
GIMP_METADATA_LOAD_COMMENT = 1 << 0,
|
||||
GIMP_METADATA_LOAD_RESOLUTION = 1 << 1,
|
||||
GIMP_METADATA_LOAD_ORIENTATION = 1 << 2,
|
||||
GIMP_METADATA_LOAD_COLORSPACE = 1 << 3,
|
||||
|
||||
GIMP_METADATA_LOAD_ALL = 0xffffffff
|
||||
} GimpMetadataLoadFlags;
|
||||
|
||||
Reference in New Issue
Block a user