file-psd: Make file-psd-save embed color profile
This commit is contained in:
committed by
Mukund Sivaraman
parent
1a025e4fbd
commit
759fad8189
@ -779,15 +779,16 @@ static void
|
|||||||
save_resources (FILE *fd,
|
save_resources (FILE *fd,
|
||||||
gint32 image_id)
|
gint32 image_id)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gchar *fileName; /* Image file name */
|
gchar *fileName; /* Image file name */
|
||||||
gint32 idActLayer; /* Id of the active layer */
|
gint32 idActLayer; /* Id of the active layer */
|
||||||
guint nActiveLayer = 0; /* Number of the active layer */
|
guint nActiveLayer = 0; /* Number of the active layer */
|
||||||
gboolean ActiveLayerPresent; /* TRUE if there's an active layer */
|
gboolean ActiveLayerPresent; /* TRUE if there's an active layer */
|
||||||
|
GimpParasite *parasite;
|
||||||
|
|
||||||
glong eof_pos; /* Position for End of file */
|
glong eof_pos; /* Position for End of file */
|
||||||
glong rsc_pos; /* Position for Lengths of Resources section */
|
glong rsc_pos; /* Position for Lengths of Resources section */
|
||||||
glong name_sec; /* Position for Lengths of Channel Names */
|
glong name_sec; /* Position for Lengths of Channel Names */
|
||||||
|
|
||||||
|
|
||||||
/* Only relevant resources in GIMP are: 0x03EE, 0x03F0 & 0x0400 */
|
/* Only relevant resources in GIMP are: 0x03EE, 0x03F0 & 0x0400 */
|
||||||
@ -955,6 +956,7 @@ save_resources (FILE *fd,
|
|||||||
write_gint16 (fd, psd_unit, "vRes unit");
|
write_gint16 (fd, psd_unit, "vRes unit");
|
||||||
write_gint16 (fd, psd_unit, "height unit");
|
write_gint16 (fd, psd_unit, "height unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------- Write Active Layer Number --------------- */
|
/* --------------- Write Active Layer Number --------------- */
|
||||||
|
|
||||||
if (ActiveLayerPresent)
|
if (ActiveLayerPresent)
|
||||||
@ -972,6 +974,21 @@ save_resources (FILE *fd,
|
|||||||
IFDBG printf ("\tTotal length of 0x0400 resource: %d\n", (int) sizeof (gint16));
|
IFDBG printf ("\tTotal length of 0x0400 resource: %d\n", (int) sizeof (gint16));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------- Write ICC profile data ------------------- */
|
||||||
|
parasite = gimp_image_get_parasite (image_id, "icc-profile");
|
||||||
|
if (parasite)
|
||||||
|
{
|
||||||
|
gint32 profile_length = gimp_parasite_data_size (parasite);
|
||||||
|
|
||||||
|
xfwrite (fd, "8BIM", 4, "imageresources signature");
|
||||||
|
write_gint16 (fd, 0x040f, "0x040f Id");
|
||||||
|
write_gint16 (fd, 0, "Id name"); /* Set to null string (two zeros) */
|
||||||
|
write_gint32 (fd, profile_length, "0x040f resource size");
|
||||||
|
xfwrite (fd, gimp_parasite_data (parasite), profile_length, "ICC profile");
|
||||||
|
|
||||||
|
gimp_parasite_free (parasite);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* --------------- Write Total Section Length --------------- */
|
/* --------------- Write Total Section Length --------------- */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user