+ if (LocaleCompare((const char *) tag, "profile") == 0)
+ {
+ if (msl_info->image[n] == (Image *) NULL)
+ {
+ ThrowMSLException(OptionError,"NoImagesDefined",
+ (const char *) tag);
+ break;
+ }
+ if (attributes == (const xmlChar **) NULL)
+ break;
+ for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
+ {
+ const char
+ *name;
+
+ const StringInfo
+ *profile;
+
+ Image
+ *profile_image;
+
+ ImageInfo
+ *profile_info;
+
+ keyword=(const char *) attributes[i++];
+ attribute=InterpretImageProperties(msl_info->image_info[n],
+ msl_info->attributes[n],(const char *) attributes[i],
+ &exception);
+ CloneString(&value,attribute);
+ if (*keyword == '+')
+ {
+ /*
+ Remove a profile from the image.
+ */
+ (void) ProfileImage(msl_info->image[n],keyword,
+ (const unsigned char *) NULL,0,MagickTrue);
+ continue;
+ }
+ /*
+ Associate a profile with the image.
+ */
+ profile_info=CloneImageInfo(msl_info->image_info[n]);
+ profile=GetImageProfile(msl_info->image[n],"iptc");
+ if (profile != (StringInfo *) NULL)
+ profile_info->profile=(void *) CloneStringInfo(profile);
+ profile_image=GetImageCache(profile_info,keyword,&exception);
+ profile_info=DestroyImageInfo(profile_info);
+ if (profile_image == (Image *) NULL)
+ {
+ char
+ name[MaxTextExtent],
+ filename[MaxTextExtent];
+
+ register char
+ *p;
+
+ StringInfo
+ *profile;
+
+ (void) CopyMagickString(filename,keyword,MaxTextExtent);
+ (void) CopyMagickString(name,keyword,MaxTextExtent);
+ for (p=filename; *p != '\0'; p++)
+ if ((*p == ':') && (IsPathDirectory(keyword) < 0) &&
+ (IsPathAccessible(keyword) == MagickFalse))
+ {
+ register char
+ *q;
+
+ /*
+ Look for profile name (e.g. name:profile).
+ */
+ (void) CopyMagickString(name,filename,(size_t)
+ (p-filename+1));
+ for (q=filename; *q != '\0'; q++)
+ *q=(*++p);
+ break;
+ }
+ profile=FileToStringInfo(filename,~0UL,&exception);
+ if (profile != (StringInfo *) NULL)
+ {
+ (void) ProfileImage(msl_info->image[n],name,
+ GetStringInfoDatum(profile),(size_t)
+ GetStringInfoLength(profile),MagickFalse);
+ profile=DestroyStringInfo(profile);
+ }
+ continue;
+ }
+ ResetImageProfileIterator(profile_image);
+ name=GetNextImageProfile(profile_image);
+ while (name != (const char *) NULL)
+ {
+ profile=GetImageProfile(profile_image,name);
+ if (profile != (StringInfo *) NULL)
+ (void) ProfileImage(msl_info->image[n],name,
+ GetStringInfoDatum(profile),(size_t)
+ GetStringInfoLength(profile),MagickFalse);
+ name=GetNextImageProfile(profile_image);
+ }
+ profile_image=DestroyImage(profile_image);
+ }
+ break;
+ }