load and save embedded ICC profiles, based on a patch from Ture Pålsson

2005-10-24  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/png.c: load and save embedded ICC profiles, based
	on a patch from Ture Pålsson (bug #319580).

	* devel-docs/parasites.txt: document the "icc-profile-name" parasite.
This commit is contained in:
Sven Neumann 2005-10-24 15:09:49 +00:00 committed by Sven Neumann
parent 4ecf49d71c
commit 02e8f588ff
3 changed files with 81 additions and 2 deletions

View File

@ -1,14 +1,21 @@
2005-10-24 Sven Neumann <sven@gimp.org>
* plug-ins/common/png.c: load and save embedded ICC profiles, based
on a patch from Ture Pålsson (bug #319580).
* devel-docs/parasites.txt: document the "icc-profile-name" parasite.
2005-10-24 Jakub Steiner <jimmac@ximian.com>
* themes/Default/images/tools/stock-tool-path-16.png
* themes/Default/images/tools/stock-tool-path-22.png: works on
dark themes (bug #168981)
dark themes (bug #168981)
2005-10-24 Jakub Steiner <jimmac@ximian.com>
* themes/Default/images/tools/stock-tool-airbrush-16.png
* themes/Default/images/tools/stock-tool-airbrush-22.png: make it
work on dark background
work on dark background
2005-10-24 Michael Natterer <mitch@gimp.org>

View File

@ -164,6 +164,13 @@ Global data follows no strict rules.
manager exists to use this parasite, and it will be used
for interchange between TIFF and PNG (identical profiles)
"icc-profile-name" (IMAGE, PERSISTENT)
The profile name is a convenient name for referring to the
profile. It is for example used in the PNG file format. The
name must be stored in UTF-8 encoding. If a file format uses
a different character encoding, it must be converted to UTF-8
for use as a parasite.
"decompose-data" (IMAGE, NONPERSISTENT)
Starting with GIMP 2.3, this is added to images produced by
the decompose plug-in, and contains information necessary to

View File

@ -1052,6 +1052,45 @@ load_image (const gchar *filename,
g_free (comment);
}
#if defined(PNG_iCCP_SUPPORTED)
/*
* Get the iCCP (colour profile) chunk, if any, and attach it as
* a parasite
*/
{
png_uint_32 proflen;
png_charp profname, profile;
int profcomp;
if (png_get_iCCP (pp, info, &profname, &profcomp, &profile, &proflen))
{
GimpParasite *parasite;
parasite = gimp_parasite_new ("icc-profile", 0, proflen, profile);
gimp_image_parasite_attach (image, parasite);
gimp_parasite_free (parasite);
if (profname)
{
gchar *tmp = g_convert (profname, strlen (profname),
"ISO-8859-1", "UTF-8", NULL, NULL, NULL);
if (tmp)
{
parasite = gimp_parasite_new ("icc-profile-name", 0,
strlen (tmp), tmp);
gimp_image_parasite_attach (image, parasite);
gimp_parasite_free (parasite);
g_free (tmp);
}
}
}
}
#endif
/*
* Done with the file...
*/
@ -1385,6 +1424,32 @@ save_image (const gchar *filename,
#endif /* PNG_LIBPNG_VER > 99 */
#if defined(PNG_iCCP_SUPPORTED)
{
GimpParasite *profile_parasite;
gchar *profile_name = NULL;
profile_parasite = gimp_image_parasite_find (orig_image_ID, "icc-profile");
if (profile_parasite)
{
GimpParasite *parasite = gimp_image_parasite_find (orig_image_ID,
"icc-profile-name");
if (parasite)
profile_name = g_convert (gimp_parasite_data (parasite),
gimp_parasite_data_size (parasite),
"UTF-8", "ISO-8859-1", NULL, NULL, NULL);
png_set_iCCP (pp, info,
profile_name ? profile_name : "ICC profile", 0,
(gchar *) gimp_parasite_data (profile_parasite),
gimp_parasite_data_size (profile_parasite));
g_free (profile_name);
}
}
#endif
png_write_info (pp, info);
/*