From: cristy Date: Thu, 23 Jan 2014 01:53:24 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2809 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55166324d63eec5bf5a353b0045be4755fb159ea;p=imagemagick --- diff --git a/MagickCore/identify.c b/MagickCore/identify.c index dcda30f6f..f6c95ccf0 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -95,26 +95,6 @@ #include "MagickCore/utility.h" #include "MagickCore/utility-private.h" #include "MagickCore/version.h" -#if defined(MAGICKCORE_LCMS_DELEGATE) -#if defined(MAGICKCORE_HAVE_LCMS_LCMS2_H) -#include -#elif defined(MAGICKCORE_HAVE_LCMS2_H) -#include "lcms2.h" -#elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H) -#include -#else -#include "lcms.h" -#endif -#endif - -/* - Define declarations. -*/ -#if defined(MAGICKCORE_LCMS_DELEGATE) -#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000) -#define cmsUInt32Number DWORD -#endif -#endif /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1142,6 +1122,9 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, image_info=DestroyImageInfo(image_info); } (void) GetImageProperty(image,"exif:*",exception); + (void) GetImageProperty(image,"icc:*",exception); + (void) GetImageProperty(image,"iptc:*",exception); + (void) GetImageProperty(image,"xmp:*",exception); ResetImagePropertyIterator(image); property=GetNextImageProperty(image); if (property != (const char *) NULL) @@ -1189,45 +1172,6 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, continue; (void) FormatLocaleFile(file," Profile-%s: %.20g bytes\n",name, (double) GetStringInfoLength(profile)); -#if defined(MAGICKCORE_LCMS_DELEGATE) - if ((LocaleCompare(name,"icc") == 0) || - (LocaleCompare(name,"icm") == 0)) - { - cmsHPROFILE - icc_profile; - - icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile), - (cmsUInt32Number) GetStringInfoLength(profile)); - if (icc_profile != (cmsHPROFILE *) NULL) - { -#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000) - const char - *name; - - name=cmsTakeProductName(icc_profile); - if (name != (const char *) NULL) - (void) FormatLocaleFile(file," %s\n",name); -#else - char - info[MaxTextExtent]; - - (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription, - "en","US",info,MaxTextExtent); - (void) FormatLocaleFile(file," Description: %s\n",info); - (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer, - "en","US",info,MaxTextExtent); - (void) FormatLocaleFile(file," Manufacturer: %s\n",info); - (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en", - "US",info,MaxTextExtent); - (void) FormatLocaleFile(file," Model: %s\n",info); - (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright, - "en","US",info,MaxTextExtent); - (void) FormatLocaleFile(file," Copyright: %s\n",info); -#endif - (void) cmsCloseProfile(icc_profile); - } - } -#endif if (LocaleCompare(name,"iptc") == 0) { char diff --git a/MagickCore/property.c b/MagickCore/property.c index a1f0da48d..94e8172b1 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -1544,6 +1544,59 @@ static MagickBooleanType GetEXIFProperty(const Image *image, return(status); } +static MagickBooleanType GetICCProperty(const Image *image,const char *key, + ExceptionInfo *exception) +{ + const StringInfo + *profile; + + profile=GetImageProfile(image,"icc"); + if (profile == (StringInfo *) NULL) + profile=GetImageProfile(image,"icm"); + if (profile == (StringInfo *) NULL) + return(MagickFalse); +#if defined(MAGICKCORE_LCMS_DELEGATE) + { + cmsHPROFILE + icc_profile; + + icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile), + (cmsUInt32Number) GetStringInfoLength(profile)); + if (icc_profile != (cmsHPROFILE *) NULL) + { +#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000) + const char + *name; + + name=cmsTakeProductName(icc_profile); + if (name != (const char *) NULL) + (void) SetImageProperty((Image *) image,"icc:name",name,exception); +#else + char + info[MaxTextExtent]; + + (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription, + "en","US",info,MaxTextExtent); + (void) SetImageProperty((Image *) image,"icc:description",info, + exception); + (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer, + "en","US",info,MaxTextExtent); + (void) SetImageProperty((Image *) image,"icc:manufacturer",info, + exception); + (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en", + "US",info,MaxTextExtent); + (void) SetImageProperty((Image *) image,"icc:model",info,exception); + (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright, + "en","US",info,MaxTextExtent); + (void) SetImageProperty((Image *) image,"icc:copyright",info,exception); +#endif + (void) cmsCloseProfile(icc_profile); + } + } +#endif + return(MagickTrue); +} + static MagickBooleanType GetXMPProperty(const Image *image,const char *property) { char @@ -2091,6 +2144,17 @@ MagickExport const char *GetImageProperty(const Image *image, case 'I': case 'i': { + if ((LocaleNCompare("icc:",property,4) == 0) || + (LocaleNCompare("icm:",property,4) == 0)) + { + if( IfMagickTrue(GetICCProperty(image,property,exception)) && + (image->properties != (void *) NULL)) + { + p=(const char *) GetValueFromSplayTree((SplayTreeInfo *) + image->properties,property); + return(p); + } + } if (LocaleNCompare("iptc:",property,5) == 0) { if( IfMagickTrue(GetIPTCProperty(image,property,exception)) && diff --git a/coders/json.c b/coders/json.c index 4f1b6e930..449ea4fca 100644 --- a/coders/json.c +++ b/coders/json.c @@ -1116,6 +1116,9 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, image_info=DestroyImageInfo(image_info); } (void) GetImageProperty(image,"exif:*",exception); + (void) GetImageProperty(image,"icc:*",exception); + (void) GetImageProperty(image,"iptc:*",exception); + (void) GetImageProperty(image,"xmp:*",exception); ResetImagePropertyIterator(image); property=GetNextImageProperty(image); if (property != (const char *) NULL)