profile.c

Go to the documentation of this file.
00001 /*
00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00003 %                                                                             %
00004 %                                                                             %
00005 %                                                                             %
00006 %               PPPP   RRRR    OOO   FFFFF  IIIII  L      EEEEE               %
00007 %               P   P  R   R  O   O  F        I    L      E                   %
00008 %               PPPP   RRRR   O   O  FFF      I    L      EEE                 %
00009 %               P      R R    O   O  F        I    L      E                   %
00010 %               P      R  R    OOO   F      IIIII  LLLLL  EEEEE               %
00011 %                                                                             %
00012 %                                                                             %
00013 %                       MagickCore Image Profile Methods                      %
00014 %                                                                             %
00015 %                              Software Design                                %
00016 %                                John Cristy                                  %
00017 %                                 July 1992                                   %
00018 %                                                                             %
00019 %                                                                             %
00020 %  Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization      %
00021 %  dedicated to making software imaging solutions freely available.           %
00022 %                                                                             %
00023 %  You may not use this file except in compliance with the License.  You may  %
00024 %  obtain a copy of the License at                                            %
00025 %                                                                             %
00026 %    http://www.imagemagick.org/script/license.php                            %
00027 %                                                                             %
00028 %  Unless required by applicable law or agreed to in writing, software        %
00029 %  distributed under the License is distributed on an "AS IS" BASIS,          %
00030 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
00031 %  See the License for the specific language governing permissions and        %
00032 %  limitations under the License.                                             %
00033 %                                                                             %
00034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00035 %
00036 %
00037 */
00038 
00039 /*
00040   Include declarations.
00041 */
00042 #include "magick/studio.h"
00043 #include "magick/cache.h"
00044 #include "magick/color.h"
00045 #include "magick/configure.h"
00046 #include "magick/exception.h"
00047 #include "magick/exception-private.h"
00048 #include "magick/hashmap.h"
00049 #include "magick/image.h"
00050 #include "magick/memory_.h"
00051 #include "magick/monitor.h"
00052 #include "magick/option.h"
00053 #include "magick/profile.h"
00054 #include "magick/property.h"
00055 #include "magick/quantum.h"
00056 #include "magick/quantum-private.h"
00057 #include "magick/splay-tree.h"
00058 #include "magick/string_.h"
00059 #include "magick/utility.h"
00060 #if defined(MAGICKCORE_LCMS_DELEGATE)
00061 #if defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
00062 #include <lcms/lcms.h>
00063 #else
00064 #include "lcms.h"
00065 #endif
00066 #endif
00067 
00068 /*
00069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00070 %                                                                             %
00071 %                                                                             %
00072 %                                                                             %
00073 %   C l o n e I m a g e P r o f i l e s                                       %
00074 %                                                                             %
00075 %                                                                             %
00076 %                                                                             %
00077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00078 %
00079 %  CloneImageProfiles() clones one or more image profiles.
00080 %
00081 %  The format of the CloneImageProfiles method is:
00082 %
00083 %      MagickBooleanType CloneImageProfiles(Image *image,
00084 %        const Image *clone_image)
00085 %
00086 %  A description of each parameter follows:
00087 %
00088 %    o image: the image.
00089 %
00090 %    o clone_image: the clone image.
00091 %
00092 */
00093 MagickExport MagickBooleanType CloneImageProfiles(Image *image,
00094   const Image *clone_image)
00095 {
00096   assert(image != (Image *) NULL);
00097   assert(image->signature == MagickSignature);
00098   if (image->debug != MagickFalse)
00099     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
00100   assert(clone_image != (const Image *) NULL);
00101   assert(clone_image->signature == MagickSignature);
00102   image->color_profile.length=clone_image->color_profile.length;
00103   image->color_profile.info=clone_image->color_profile.info;
00104   image->iptc_profile.length=clone_image->iptc_profile.length;
00105   image->iptc_profile.info=clone_image->iptc_profile.info;
00106   if (clone_image->profiles != (void *) NULL)
00107     image->profiles=CloneSplayTree((SplayTreeInfo *) clone_image->profiles,
00108       (void *(*)(void *)) ConstantString,(void *(*)(void *)) CloneStringInfo);
00109   return(MagickTrue);
00110 }
00111 
00112 /*
00113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00114 %                                                                             %
00115 %                                                                             %
00116 %                                                                             %
00117 %   D e l e t e I m a g e P r o f i l e                                       %
00118 %                                                                             %
00119 %                                                                             %
00120 %                                                                             %
00121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00122 %
00123 %  DeleteImageProfile() deletes a profile from the image by its name.
00124 %
00125 %  The format of the DeleteImageProfile method is:
00126 %
00127 %      MagickBooleanTyupe DeleteImageProfile(Image *image,const char *name)
00128 %
00129 %  A description of each parameter follows:
00130 %
00131 %    o image: the image.
00132 %
00133 %    o name: the profile name.
00134 %
00135 */
00136 MagickExport MagickBooleanType DeleteImageProfile(Image *image,
00137   const char *name)
00138 {
00139   assert(image != (Image *) NULL);
00140   assert(image->signature == MagickSignature);
00141   if (image->debug != MagickFalse)
00142     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
00143   if (image->profiles == (SplayTreeInfo *) NULL)
00144     return(MagickFalse);
00145   if (LocaleCompare(name,"icc") == 0)
00146     {
00147       /*
00148         Continue to support deprecated color profile for now.
00149       */
00150       image->color_profile.length=0;
00151       image->color_profile.info=(unsigned char *) NULL;
00152     }
00153   if (LocaleCompare(name,"iptc") == 0)
00154     {
00155       /*
00156         Continue to support deprecated IPTC profile for now.
00157       */
00158       image->iptc_profile.length=0;
00159       image->iptc_profile.info=(unsigned char *) NULL;
00160     }
00161   return(DeleteNodeFromSplayTree((SplayTreeInfo *) image->profiles,name));
00162 }
00163 
00164 /*
00165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00166 %                                                                             %
00167 %                                                                             %
00168 %                                                                             %
00169 %   D e s t r o y I m a g e P r o f i l e s                                   %
00170 %                                                                             %
00171 %                                                                             %
00172 %                                                                             %
00173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00174 %
00175 %  DestroyImageProfiles() releases memory associated with an image profile map.
00176 %
00177 %  The format of the DestroyProfiles method is:
00178 %
00179 %      void DestroyImageProfiles(Image *image)
00180 %
00181 %  A description of each parameter follows:
00182 %
00183 %    o image: the image.
00184 %
00185 */
00186 MagickExport void DestroyImageProfiles(Image *image)
00187 {
00188   if (image->profiles != (SplayTreeInfo *) NULL)
00189     image->profiles=DestroySplayTree((SplayTreeInfo *) image->profiles);
00190 }
00191 
00192 /*
00193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00194 %                                                                             %
00195 %                                                                             %
00196 %                                                                             %
00197 %   G e t I m a g e P r o f i l e                                             %
00198 %                                                                             %
00199 %                                                                             %
00200 %                                                                             %
00201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00202 %
00203 %  GetImageProfile() gets a profile associated with an image by name.
00204 %
00205 %  The format of the GetImageProfile method is:
00206 %
00207 %      const StringInfo *GetImageProfile(const Image *image,const char *name)
00208 %
00209 %  A description of each parameter follows:
00210 %
00211 %    o image: the image.
00212 %
00213 %    o name: the profile name.
00214 %
00215 */
00216 MagickExport const StringInfo *GetImageProfile(const Image *image,
00217   const char *name)
00218 {
00219   char
00220     key[MaxTextExtent];
00221 
00222   const StringInfo
00223     *profile;
00224 
00225   assert(image != (Image *) NULL);
00226   assert(image->signature == MagickSignature);
00227   if (image->debug != MagickFalse)
00228     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
00229   if (image->profiles == (SplayTreeInfo *) NULL)
00230     return((StringInfo *) NULL);
00231   (void) CopyMagickString(key,name,MaxTextExtent);
00232   profile=(const StringInfo *) GetValueFromSplayTree((SplayTreeInfo *)
00233     image->profiles,key);
00234   return(profile);
00235 }
00236 
00237 /*
00238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00239 %                                                                             %
00240 %                                                                             %
00241 %                                                                             %
00242 %   G e t N e x t I m a g e P r o f i l e                                     %
00243 %                                                                             %
00244 %                                                                             %
00245 %                                                                             %
00246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00247 %
00248 %  GetNextImageProfile() gets the next profile name for an image.
00249 %
00250 %  The format of the GetNextImageProfile method is:
00251 %
00252 %      char *GetNextImageProfile(const Image *image)
00253 %
00254 %  A description of each parameter follows:
00255 %
00256 %    o hash_info: the hash info.
00257 %
00258 */
00259 MagickExport char *GetNextImageProfile(const Image *image)
00260 {
00261   assert(image != (Image *) NULL);
00262   assert(image->signature == MagickSignature);
00263   if (image->debug != MagickFalse)
00264     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
00265   if (image->profiles == (SplayTreeInfo *) NULL)
00266     return((char *) NULL);
00267   return((char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->profiles));
00268 }
00269 
00270 /*
00271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00272 %                                                                             %
00273 %                                                                             %
00274 %                                                                             %
00275 %   P r o f i l e I m a g e                                                   %
00276 %                                                                             %
00277 %                                                                             %
00278 %                                                                             %
00279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00280 %
00281 %  ProfileImage() associates, applies, or removes an ICM, IPTC, or generic
00282 %  profile with / to / from an image.  If the profile is NULL, it is removed
00283 %  from the image otherwise added or applied.  Use a name of '*' and a profile
00284 %  of NULL to remove all profiles from the image.
00285 %
00286 %  ICC and ICM profiles are handled as follows: If the image does not have
00287 %  an associated color profile, the one you provide is associated with the
00288 %  image and the image pixels are not transformed.  Otherwise, the colorspace
00289 %  transform defined by the existing and new profile are applied to the image
00290 %  pixels and the new profile is associated with the image.
00291 %
00292 %  The format of the ProfileImage method is:
00293 %
00294 %      MagickBooleanType ProfileImage(Image *image,const char *name,
00295 %        const void *datum,const size_t length,const MagickBooleanType clone)
00296 %
00297 %  A description of each parameter follows:
00298 %
00299 %    o image: the image.
00300 %
00301 %    o name: Name of profile to add or remove: ICC, IPTC, or generic profile.
00302 %
00303 %    o datum: the profile data.
00304 %
00305 %    o length: the length of the profile.
00306 %
00307 %    o clone: should be MagickFalse.
00308 %
00309 */
00310 
00311 static MagickBooleanType SetAdobeRGB1998ImageProfile(Image *image)
00312 {
00313   static unsigned char
00314     AdobeRGB1998Profile[] =
00315     {
00316       0x00, 0x00, 0x02, 0x30, 0x41, 0x44, 0x42, 0x45, 0x02, 0x10, 0x00,
00317       0x00, 0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59,
00318       0x5a, 0x20, 0x07, 0xd0, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x13, 0x00,
00319       0x33, 0x00, 0x3b, 0x61, 0x63, 0x73, 0x70, 0x41, 0x50, 0x50, 0x4c,
00320       0x00, 0x00, 0x00, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00,
00321       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00322       0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00,
00323       0x00, 0xd3, 0x2d, 0x41, 0x44, 0x42, 0x45, 0x00, 0x00, 0x00, 0x00,
00324       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00325       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00326       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00327       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
00328       0x63, 0x70, 0x72, 0x74, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00,
00329       0x32, 0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x01, 0x30, 0x00, 0x00,
00330       0x00, 0x6b, 0x77, 0x74, 0x70, 0x74, 0x00, 0x00, 0x01, 0x9c, 0x00,
00331       0x00, 0x00, 0x14, 0x62, 0x6b, 0x70, 0x74, 0x00, 0x00, 0x01, 0xb0,
00332       0x00, 0x00, 0x00, 0x14, 0x72, 0x54, 0x52, 0x43, 0x00, 0x00, 0x01,
00333       0xc4, 0x00, 0x00, 0x00, 0x0e, 0x67, 0x54, 0x52, 0x43, 0x00, 0x00,
00334       0x01, 0xd4, 0x00, 0x00, 0x00, 0x0e, 0x62, 0x54, 0x52, 0x43, 0x00,
00335       0x00, 0x01, 0xe4, 0x00, 0x00, 0x00, 0x0e, 0x72, 0x58, 0x59, 0x5a,
00336       0x00, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x00, 0x14, 0x67, 0x58, 0x59,
00337       0x5a, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x14, 0x62, 0x58,
00338       0x59, 0x5a, 0x00, 0x00, 0x02, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x74,
00339       0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70, 0x79,
00340       0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x30, 0x20,
00341       0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65,
00342       0x6d, 0x73, 0x20, 0x49, 0x6e, 0x63, 0x6f, 0x72, 0x70, 0x6f, 0x72,
00343       0x61, 0x74, 0x65, 0x64, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
00344       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x41, 0x64, 0x6f,
00345       0x62, 0x65, 0x20, 0x52, 0x47, 0x42, 0x20, 0x28, 0x31, 0x39, 0x39,
00346       0x38, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00347       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00348       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00349       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00350       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00351       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00352       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00353       0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00,
00354       0x00, 0x00, 0x00, 0x00, 0xf3, 0x51, 0x00, 0x01, 0x00, 0x00, 0x00,
00355       0x01, 0x16, 0xcc, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
00356       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00357       0x00, 0x63, 0x75, 0x72, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00358       0x00, 0x01, 0x02, 0x33, 0x00, 0x00, 0x63, 0x75, 0x72, 0x76, 0x00,
00359       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x33, 0x00, 0x00,
00360       0x63, 0x75, 0x72, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00361       0x01, 0x02, 0x33, 0x00, 0x00, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00,
00362       0x00, 0x00, 0x00, 0x00, 0x9c, 0x18, 0x00, 0x00, 0x4f, 0xa5, 0x00,
00363       0x00, 0x04, 0xfc, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
00364       0x00, 0x00, 0x34, 0x8d, 0x00, 0x00, 0xa0, 0x2c, 0x00, 0x00, 0x0f,
00365       0x95, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00366       0x26, 0x31, 0x00, 0x00, 0x10, 0x2f, 0x00, 0x00, 0xbe, 0x9c
00367     };
00368 
00369   StringInfo
00370     *profile;
00371 
00372   MagickBooleanType
00373     status;
00374 
00375   assert(image != (Image *) NULL);
00376   assert(image->signature == MagickSignature);
00377   if (GetImageProfile(image,"icm") != (const StringInfo *) NULL)
00378     return(MagickFalse);
00379   profile=AcquireStringInfo(sizeof(AdobeRGB1998Profile));
00380   SetStringInfoDatum(profile,AdobeRGB1998Profile);
00381   status=SetImageProfile(image,"icm",profile);
00382   profile=DestroyStringInfo(profile);
00383   return(status);
00384 }
00385 
00386 static MagickBooleanType SetsRGBImageProfile(Image *image)
00387 {
00388   static unsigned char
00389     sRGBProfile[] =
00390     {
00391       0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f, 0x02, 0x10, 0x00,
00392       0x00, 0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59,
00393       0x5a, 0x20, 0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06, 0x00,
00394       0x31, 0x00, 0x00, 0x61, 0x63, 0x73, 0x70, 0x4d, 0x53, 0x46, 0x54,
00395       0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x43, 0x20, 0x73, 0x52, 0x47,
00396       0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00397       0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00,
00398       0x00, 0xd3, 0x2d, 0x48, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
00399       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00400       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00401       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00402       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11,
00403       0x63, 0x70, 0x72, 0x74, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00,
00404       0x33, 0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x01, 0x84, 0x00, 0x00,
00405       0x00, 0x6c, 0x77, 0x74, 0x70, 0x74, 0x00, 0x00, 0x01, 0xf0, 0x00,
00406       0x00, 0x00, 0x14, 0x62, 0x6b, 0x70, 0x74, 0x00, 0x00, 0x02, 0x04,
00407       0x00, 0x00, 0x00, 0x14, 0x72, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x02,
00408       0x18, 0x00, 0x00, 0x00, 0x14, 0x67, 0x58, 0x59, 0x5a, 0x00, 0x00,
00409       0x02, 0x2c, 0x00, 0x00, 0x00, 0x14, 0x62, 0x58, 0x59, 0x5a, 0x00,
00410       0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x14, 0x64, 0x6d, 0x6e, 0x64,
00411       0x00, 0x00, 0x02, 0x54, 0x00, 0x00, 0x00, 0x70, 0x64, 0x6d, 0x64,
00412       0x64, 0x00, 0x00, 0x02, 0xc4, 0x00, 0x00, 0x00, 0x88, 0x76, 0x75,
00413       0x65, 0x64, 0x00, 0x00, 0x03, 0x4c, 0x00, 0x00, 0x00, 0x86, 0x76,
00414       0x69, 0x65, 0x77, 0x00, 0x00, 0x03, 0xd4, 0x00, 0x00, 0x00, 0x24,
00415       0x6c, 0x75, 0x6d, 0x69, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00,
00416       0x14, 0x6d, 0x65, 0x61, 0x73, 0x00, 0x00, 0x04, 0x0c, 0x00, 0x00,
00417       0x00, 0x24, 0x74, 0x65, 0x63, 0x68, 0x00, 0x00, 0x04, 0x30, 0x00,
00418       0x00, 0x00, 0x0c, 0x72, 0x54, 0x52, 0x43, 0x00, 0x00, 0x04, 0x3c,
00419       0x00, 0x00, 0x08, 0x0c, 0x67, 0x54, 0x52, 0x43, 0x00, 0x00, 0x04,
00420       0x3c, 0x00, 0x00, 0x08, 0x0c, 0x62, 0x54, 0x52, 0x43, 0x00, 0x00,
00421       0x04, 0x3c, 0x00, 0x00, 0x08, 0x0c, 0x74, 0x65, 0x78, 0x74, 0x00,
00422       0x00, 0x00, 0x00, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
00423       0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x38, 0x20,
00424       0x48, 0x65, 0x77, 0x6c, 0x65, 0x74, 0x74, 0x2d, 0x50, 0x61, 0x63,
00425       0x6b, 0x61, 0x72, 0x64, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e,
00426       0x79, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x00, 0x00,
00427       0x00, 0x00, 0x00, 0x12, 0x73, 0x52, 0x47, 0x42, 0x20, 0x49, 0x45,
00428       0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x00,
00429       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
00430       0x73, 0x52, 0x47, 0x42, 0x20, 0x49, 0x45, 0x43, 0x36, 0x31, 0x39,
00431       0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
00432       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00433       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00434       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00435       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00436       0x00, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00437       0xf3, 0x51, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x16, 0xcc, 0x58,
00438       0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00439       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x59, 0x5a,
00440       0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xa2, 0x00, 0x00,
00441       0x38, 0xf5, 0x00, 0x00, 0x03, 0x90, 0x58, 0x59, 0x5a, 0x20, 0x00,
00442       0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x99, 0x00, 0x00, 0xb7, 0x85,
00443       0x00, 0x00, 0x18, 0xda, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00,
00444       0x00, 0x00, 0x00, 0x24, 0xa0, 0x00, 0x00, 0x0f, 0x84, 0x00, 0x00,
00445       0xb6, 0xcf, 0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
00446       0x00, 0x00, 0x16, 0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74, 0x70,
00447       0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x65, 0x63, 0x2e,
00448       0x63, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00449       0x00, 0x00, 0x16, 0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74, 0x70,
00450       0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x65, 0x63, 0x2e,
00451       0x63, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00452       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00453       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00454       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00455       0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x00,
00456       0x00, 0x00, 0x00, 0x00, 0x2e, 0x49, 0x45, 0x43, 0x20, 0x36, 0x31,
00457       0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44, 0x65, 0x66,
00458       0x61, 0x75, 0x6c, 0x74, 0x20, 0x52, 0x47, 0x42, 0x20, 0x63, 0x6f,
00459       0x6c, 0x6f, 0x75, 0x72, 0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20,
00460       0x2d, 0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
00461       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x49, 0x45, 0x43, 0x20,
00462       0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44,
00463       0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x52, 0x47, 0x42, 0x20,
00464       0x63, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x20, 0x73, 0x70, 0x61, 0x63,
00465       0x65, 0x20, 0x2d, 0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00, 0x00,
00466       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00467       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73,
00468       0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x52, 0x65,
00469       0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x56, 0x69, 0x65,
00470       0x77, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74,
00471       0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45, 0x43, 0x36,
00472       0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x00, 0x00, 0x00,
00473       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x52, 0x65,
00474       0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x56, 0x69, 0x65,
00475       0x77, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74,
00476       0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45, 0x43, 0x36,
00477       0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x00, 0x00, 0x00,
00478       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00479       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00480       0x00, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13,
00481       0xa4, 0xfe, 0x00, 0x14, 0x5f, 0x2e, 0x00, 0x10, 0xcf, 0x14, 0x00,
00482       0x03, 0xed, 0xcc, 0x00, 0x04, 0x13, 0x0b, 0x00, 0x03, 0x5c, 0x9e,
00483       0x00, 0x00, 0x00, 0x01, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00,
00484       0x00, 0x00, 0x4c, 0x09, 0x56, 0x00, 0x50, 0x00, 0x00, 0x00, 0x57,
00485       0x1f, 0xe7, 0x6d, 0x65, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00,
00486       0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00487       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
00488       0x8f, 0x00, 0x00, 0x00, 0x02, 0x73, 0x69, 0x67, 0x20, 0x00, 0x00,
00489       0x00, 0x00, 0x43, 0x52, 0x54, 0x20, 0x63, 0x75, 0x72, 0x76, 0x00,
00490       0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x05,
00491       0x00, 0x0a, 0x00, 0x0f, 0x00, 0x14, 0x00, 0x19, 0x00, 0x1e, 0x00,
00492       0x23, 0x00, 0x28, 0x00, 0x2d, 0x00, 0x32, 0x00, 0x37, 0x00, 0x3b,
00493       0x00, 0x40, 0x00, 0x45, 0x00, 0x4a, 0x00, 0x4f, 0x00, 0x54, 0x00,
00494       0x59, 0x00, 0x5e, 0x00, 0x63, 0x00, 0x68, 0x00, 0x6d, 0x00, 0x72,
00495       0x00, 0x77, 0x00, 0x7c, 0x00, 0x81, 0x00, 0x86, 0x00, 0x8b, 0x00,
00496       0x90, 0x00, 0x95, 0x00, 0x9a, 0x00, 0x9f, 0x00, 0xa4, 0x00, 0xa9,
00497       0x00, 0xae, 0x00, 0xb2, 0x00, 0xb7, 0x00, 0xbc, 0x00, 0xc1, 0x00,
00498       0xc6, 0x00, 0xcb, 0x00, 0xd0, 0x00, 0xd5, 0x00, 0xdb, 0x00, 0xe0,
00499       0x00, 0xe5, 0x00, 0xeb, 0x00, 0xf0, 0x00, 0xf6, 0x00, 0xfb, 0x01,
00500       0x01, 0x01, 0x07, 0x01, 0x0d, 0x01, 0x13, 0x01, 0x19, 0x01, 0x1f,
00501       0x01, 0x25, 0x01, 0x2b, 0x01, 0x32, 0x01, 0x38, 0x01, 0x3e, 0x01,
00502       0x45, 0x01, 0x4c, 0x01, 0x52, 0x01, 0x59, 0x01, 0x60, 0x01, 0x67,
00503       0x01, 0x6e, 0x01, 0x75, 0x01, 0x7c, 0x01, 0x83, 0x01, 0x8b, 0x01,
00504       0x92, 0x01, 0x9a, 0x01, 0xa1, 0x01, 0xa9, 0x01, 0xb1, 0x01, 0xb9,
00505       0x01, 0xc1, 0x01, 0xc9, 0x01, 0xd1, 0x01, 0xd9, 0x01, 0xe1, 0x01,
00506       0xe9, 0x01, 0xf2, 0x01, 0xfa, 0x02, 0x03, 0x02, 0x0c, 0x02, 0x14,
00507       0x02, 0x1d, 0x02, 0x26, 0x02, 0x2f, 0x02, 0x38, 0x02, 0x41, 0x02,
00508       0x4b, 0x02, 0x54, 0x02, 0x5d, 0x02, 0x67, 0x02, 0x71, 0x02, 0x7a,
00509       0x02, 0x84, 0x02, 0x8e, 0x02, 0x98, 0x02, 0xa2, 0x02, 0xac, 0x02,
00510       0xb6, 0x02, 0xc1, 0x02, 0xcb, 0x02, 0xd5, 0x02, 0xe0, 0x02, 0xeb,
00511       0x02, 0xf5, 0x03, 0x00, 0x03, 0x0b, 0x03, 0x16, 0x03, 0x21, 0x03,
00512       0x2d, 0x03, 0x38, 0x03, 0x43, 0x03, 0x4f, 0x03, 0x5a, 0x03, 0x66,
00513       0x03, 0x72, 0x03, 0x7e, 0x03, 0x8a, 0x03, 0x96, 0x03, 0xa2, 0x03,
00514       0xae, 0x03, 0xba, 0x03, 0xc7, 0x03, 0xd3, 0x03, 0xe0, 0x03, 0xec,
00515       0x03, 0xf9, 0x04, 0x06, 0x04, 0x13, 0x04, 0x20, 0x04, 0x2d, 0x04,
00516       0x3b, 0x04, 0x48, 0x04, 0x55, 0x04, 0x63, 0x04, 0x71, 0x04, 0x7e,
00517       0x04, 0x8c, 0x04, 0x9a, 0x04, 0xa8, 0x04, 0xb6, 0x04, 0xc4, 0x04,
00518       0xd3, 0x04, 0xe1, 0x04, 0xf0, 0x04, 0xfe, 0x05, 0x0d, 0x05, 0x1c,
00519       0x05, 0x2b, 0x05, 0x3a, 0x05, 0x49, 0x05, 0x58, 0x05, 0x67, 0x05,
00520       0x77, 0x05, 0x86, 0x05, 0x96, 0x05, 0xa6, 0x05, 0xb5, 0x05, 0xc5,
00521       0x05, 0xd5, 0x05, 0xe5, 0x05, 0xf6, 0x06, 0x06, 0x06, 0x16, 0x06,
00522       0x27, 0x06, 0x37, 0x06, 0x48, 0x06, 0x59, 0x06, 0x6a, 0x06, 0x7b,
00523       0x06, 0x8c, 0x06, 0x9d, 0x06, 0xaf, 0x06, 0xc0, 0x06, 0xd1, 0x06,
00524       0xe3, 0x06, 0xf5, 0x07, 0x07, 0x07, 0x19, 0x07, 0x2b, 0x07, 0x3d,
00525       0x07, 0x4f, 0x07, 0x61, 0x07, 0x74, 0x07, 0x86, 0x07, 0x99, 0x07,
00526       0xac, 0x07, 0xbf, 0x07, 0xd2, 0x07, 0xe5, 0x07, 0xf8, 0x08, 0x0b,
00527       0x08, 0x1f, 0x08, 0x32, 0x08, 0x46, 0x08, 0x5a, 0x08, 0x6e, 0x08,
00528       0x82, 0x08, 0x96, 0x08, 0xaa, 0x08, 0xbe, 0x08, 0xd2, 0x08, 0xe7,
00529       0x08, 0xfb, 0x09, 0x10, 0x09, 0x25, 0x09, 0x3a, 0x09, 0x4f, 0x09,
00530       0x64, 0x09, 0x79, 0x09, 0x8f, 0x09, 0xa4, 0x09, 0xba, 0x09, 0xcf,
00531       0x09, 0xe5, 0x09, 0xfb, 0x0a, 0x11, 0x0a, 0x27, 0x0a, 0x3d, 0x0a,
00532       0x54, 0x0a, 0x6a, 0x0a, 0x81, 0x0a, 0x98, 0x0a, 0xae, 0x0a, 0xc5,
00533       0x0a, 0xdc, 0x0a, 0xf3, 0x0b, 0x0b, 0x0b, 0x22, 0x0b, 0x39, 0x0b,
00534       0x51, 0x0b, 0x69, 0x0b, 0x80, 0x0b, 0x98, 0x0b, 0xb0, 0x0b, 0xc8,
00535       0x0b, 0xe1, 0x0b, 0xf9, 0x0c, 0x12, 0x0c, 0x2a, 0x0c, 0x43, 0x0c,
00536       0x5c, 0x0c, 0x75, 0x0c, 0x8e, 0x0c, 0xa7, 0x0c, 0xc0, 0x0c, 0xd9,
00537       0x0c, 0xf3, 0x0d, 0x0d, 0x0d, 0x26, 0x0d, 0x40, 0x0d, 0x5a, 0x0d,
00538       0x74, 0x0d, 0x8e, 0x0d, 0xa9, 0x0d, 0xc3, 0x0d, 0xde, 0x0d, 0xf8,
00539       0x0e, 0x13, 0x0e, 0x2e, 0x0e, 0x49, 0x0e, 0x64, 0x0e, 0x7f, 0x0e,
00540       0x9b, 0x0e, 0xb6, 0x0e, 0xd2, 0x0e, 0xee, 0x0f, 0x09, 0x0f, 0x25,
00541       0x0f, 0x41, 0x0f, 0x5e, 0x0f, 0x7a, 0x0f, 0x96, 0x0f, 0xb3, 0x0f,
00542       0xcf, 0x0f, 0xec, 0x10, 0x09, 0x10, 0x26, 0x10, 0x43, 0x10, 0x61,
00543       0x10, 0x7e, 0x10, 0x9b, 0x10, 0xb9, 0x10, 0xd7, 0x10, 0xf5, 0x11,
00544       0x13, 0x11, 0x31, 0x11, 0x4f, 0x11, 0x6d, 0x11, 0x8c, 0x11, 0xaa,
00545       0x11, 0xc9, 0x11, 0xe8, 0x12, 0x07, 0x12, 0x26, 0x12, 0x45, 0x12,
00546       0x64, 0x12, 0x84, 0x12, 0xa3, 0x12, 0xc3, 0x12, 0xe3, 0x13, 0x03,
00547       0x13, 0x23, 0x13, 0x43, 0x13, 0x63, 0x13, 0x83, 0x13, 0xa4, 0x13,
00548       0xc5, 0x13, 0xe5, 0x14, 0x06, 0x14, 0x27, 0x14, 0x49, 0x14, 0x6a,
00549       0x14, 0x8b, 0x14, 0xad, 0x14, 0xce, 0x14, 0xf0, 0x15, 0x12, 0x15,
00550       0x34, 0x15, 0x56, 0x15, 0x78, 0x15, 0x9b, 0x15, 0xbd, 0x15, 0xe0,
00551       0x16, 0x03, 0x16, 0x26, 0x16, 0x49, 0x16, 0x6c, 0x16, 0x8f, 0x16,
00552       0xb2, 0x16, 0xd6, 0x16, 0xfa, 0x17, 0x1d, 0x17, 0x41, 0x17, 0x65,
00553       0x17, 0x89, 0x17, 0xae, 0x17, 0xd2, 0x17, 0xf7, 0x18, 0x1b, 0x18,
00554       0x40, 0x18, 0x65, 0x18, 0x8a, 0x18, 0xaf, 0x18, 0xd5, 0x18, 0xfa,
00555       0x19, 0x20, 0x19, 0x45, 0x19, 0x6b, 0x19, 0x91, 0x19, 0xb7, 0x19,
00556       0xdd, 0x1a, 0x04, 0x1a, 0x2a, 0x1a, 0x51, 0x1a, 0x77, 0x1a, 0x9e,
00557       0x1a, 0xc5, 0x1a, 0xec, 0x1b, 0x14, 0x1b, 0x3b, 0x1b, 0x63, 0x1b,
00558       0x8a, 0x1b, 0xb2, 0x1b, 0xda, 0x1c, 0x02, 0x1c, 0x2a, 0x1c, 0x52,
00559       0x1c, 0x7b, 0x1c, 0xa3, 0x1c, 0xcc, 0x1c, 0xf5, 0x1d, 0x1e, 0x1d,
00560       0x47, 0x1d, 0x70, 0x1d, 0x99, 0x1d, 0xc3, 0x1d, 0xec, 0x1e, 0x16,
00561       0x1e, 0x40, 0x1e, 0x6a, 0x1e, 0x94, 0x1e, 0xbe, 0x1e, 0xe9, 0x1f,
00562       0x13, 0x1f, 0x3e, 0x1f, 0x69, 0x1f, 0x94, 0x1f, 0xbf, 0x1f, 0xea,
00563       0x20, 0x15, 0x20, 0x41, 0x20, 0x6c, 0x20, 0x98, 0x20, 0xc4, 0x20,
00564       0xf0, 0x21, 0x1c, 0x21, 0x48, 0x21, 0x75, 0x21, 0xa1, 0x21, 0xce,
00565       0x21, 0xfb, 0x22, 0x27, 0x22, 0x55, 0x22, 0x82, 0x22, 0xaf, 0x22,
00566       0xdd, 0x23, 0x0a, 0x23, 0x38, 0x23, 0x66, 0x23, 0x94, 0x23, 0xc2,
00567       0x23, 0xf0, 0x24, 0x1f, 0x24, 0x4d, 0x24, 0x7c, 0x24, 0xab, 0x24,
00568       0xda, 0x25, 0x09, 0x25, 0x38, 0x25, 0x68, 0x25, 0x97, 0x25, 0xc7,
00569       0x25, 0xf7, 0x26, 0x27, 0x26, 0x57, 0x26, 0x87, 0x26, 0xb7, 0x26,
00570       0xe8, 0x27, 0x18, 0x27, 0x49, 0x27, 0x7a, 0x27, 0xab, 0x27, 0xdc,
00571       0x28, 0x0d, 0x28, 0x3f, 0x28, 0x71, 0x28, 0xa2, 0x28, 0xd4, 0x29,
00572       0x06, 0x29, 0x38, 0x29, 0x6b, 0x29, 0x9d, 0x29, 0xd0, 0x2a, 0x02,
00573       0x2a, 0x35, 0x2a, 0x68, 0x2a, 0x9b, 0x2a, 0xcf, 0x2b, 0x02, 0x2b,
00574       0x36, 0x2b, 0x69, 0x2b, 0x9d, 0x2b, 0xd1, 0x2c, 0x05, 0x2c, 0x39,
00575       0x2c, 0x6e, 0x2c, 0xa2, 0x2c, 0xd7, 0x2d, 0x0c, 0x2d, 0x41, 0x2d,
00576       0x76, 0x2d, 0xab, 0x2d, 0xe1, 0x2e, 0x16, 0x2e, 0x4c, 0x2e, 0x82,
00577       0x2e, 0xb7, 0x2e, 0xee, 0x2f, 0x24, 0x2f, 0x5a, 0x2f, 0x91, 0x2f,
00578       0xc7, 0x2f, 0xfe, 0x30, 0x35, 0x30, 0x6c, 0x30, 0xa4, 0x30, 0xdb,
00579       0x31, 0x12, 0x31, 0x4a, 0x31, 0x82, 0x31, 0xba, 0x31, 0xf2, 0x32,
00580       0x2a, 0x32, 0x63, 0x32, 0x9b, 0x32, 0xd4, 0x33, 0x0d, 0x33, 0x46,
00581       0x33, 0x7f, 0x33, 0xb8, 0x33, 0xf1, 0x34, 0x2b, 0x34, 0x65, 0x34,
00582       0x9e, 0x34, 0xd8, 0x35, 0x13, 0x35, 0x4d, 0x35, 0x87, 0x35, 0xc2,
00583       0x35, 0xfd, 0x36, 0x37, 0x36, 0x72, 0x36, 0xae, 0x36, 0xe9, 0x37,
00584       0x24, 0x37, 0x60, 0x37, 0x9c, 0x37, 0xd7, 0x38, 0x14, 0x38, 0x50,
00585       0x38, 0x8c, 0x38, 0xc8, 0x39, 0x05, 0x39, 0x42, 0x39, 0x7f, 0x39,
00586       0xbc, 0x39, 0xf9, 0x3a, 0x36, 0x3a, 0x74, 0x3a, 0xb2, 0x3a, 0xef,
00587       0x3b, 0x2d, 0x3b, 0x6b, 0x3b, 0xaa, 0x3b, 0xe8, 0x3c, 0x27, 0x3c,
00588       0x65, 0x3c, 0xa4, 0x3c, 0xe3, 0x3d, 0x22, 0x3d, 0x61, 0x3d, 0xa1,
00589       0x3d, 0xe0, 0x3e, 0x20, 0x3e, 0x60, 0x3e, 0xa0, 0x3e, 0xe0, 0x3f,
00590       0x21, 0x3f, 0x61, 0x3f, 0xa2, 0x3f, 0xe2, 0x40, 0x23, 0x40, 0x64,
00591       0x40, 0xa6, 0x40, 0xe7, 0x41, 0x29, 0x41, 0x6a, 0x41, 0xac, 0x41,
00592       0xee, 0x42, 0x30, 0x42, 0x72, 0x42, 0xb5, 0x42, 0xf7, 0x43, 0x3a,
00593       0x43, 0x7d, 0x43, 0xc0, 0x44, 0x03, 0x44, 0x47, 0x44, 0x8a, 0x44,
00594       0xce, 0x45, 0x12, 0x45, 0x55, 0x45, 0x9a, 0x45, 0xde, 0x46, 0x22,
00595       0x46, 0x67, 0x46, 0xab, 0x46, 0xf0, 0x47, 0x35, 0x47, 0x7b, 0x47,
00596       0xc0, 0x48, 0x05, 0x48, 0x4b, 0x48, 0x91, 0x48, 0xd7, 0x49, 0x1d,
00597       0x49, 0x63, 0x49, 0xa9, 0x49, 0xf0, 0x4a, 0x37, 0x4a, 0x7d, 0x4a,
00598       0xc4, 0x4b, 0x0c, 0x4b, 0x53, 0x4b, 0x9a, 0x4b, 0xe2, 0x4c, 0x2a,
00599       0x4c, 0x72, 0x4c, 0xba, 0x4d, 0x02, 0x4d, 0x4a, 0x4d, 0x93, 0x4d,
00600       0xdc, 0x4e, 0x25, 0x4e, 0x6e, 0x4e, 0xb7, 0x4f, 0x00, 0x4f, 0x49,
00601       0x4f, 0x93, 0x4f, 0xdd, 0x50, 0x27, 0x50, 0x71, 0x50, 0xbb, 0x51,
00602       0x06, 0x51, 0x50, 0x51, 0x9b, 0x51, 0xe6, 0x52, 0x31, 0x52, 0x7c,
00603       0x52, 0xc7, 0x53, 0x13, 0x53, 0x5f, 0x53, 0xaa, 0x53, 0xf6, 0x54,
00604       0x42, 0x54, 0x8f, 0x54, 0xdb, 0x55, 0x28, 0x55, 0x75, 0x55, 0xc2,
00605       0x56, 0x0f, 0x56, 0x5c, 0x56, 0xa9, 0x56, 0xf7, 0x57, 0x44, 0x57,
00606       0x92, 0x57, 0xe0, 0x58, 0x2f, 0x58, 0x7d, 0x58, 0xcb, 0x59, 0x1a,
00607       0x59, 0x69, 0x59, 0xb8, 0x5a, 0x07, 0x5a, 0x56, 0x5a, 0xa6, 0x5a,
00608       0xf5, 0x5b, 0x45, 0x5b, 0x95, 0x5b, 0xe5, 0x5c, 0x35, 0x5c, 0x86,
00609       0x5c, 0xd6, 0x5d, 0x27, 0x5d, 0x78, 0x5d, 0xc9, 0x5e, 0x1a, 0x5e,
00610       0x6c, 0x5e, 0xbd, 0x5f, 0x0f, 0x5f, 0x61, 0x5f, 0xb3, 0x60, 0x05,
00611       0x60, 0x57, 0x60, 0xaa, 0x60, 0xfc, 0x61, 0x4f, 0x61, 0xa2, 0x61,
00612       0xf5, 0x62, 0x49, 0x62, 0x9c, 0x62, 0xf0, 0x63, 0x43, 0x63, 0x97,
00613       0x63, 0xeb, 0x64, 0x40, 0x64, 0x94, 0x64, 0xe9, 0x65, 0x3d, 0x65,
00614       0x92, 0x65, 0xe7, 0x66, 0x3d, 0x66, 0x92, 0x66, 0xe8, 0x67, 0x3d,
00615       0x67, 0x93, 0x67, 0xe9, 0x68, 0x3f, 0x68, 0x96, 0x68, 0xec, 0x69,
00616       0x43, 0x69, 0x9a, 0x69, 0xf1, 0x6a, 0x48, 0x6a, 0x9f, 0x6a, 0xf7,
00617       0x6b, 0x4f, 0x6b, 0xa7, 0x6b, 0xff, 0x6c, 0x57, 0x6c, 0xaf, 0x6d,
00618       0x08, 0x6d, 0x60, 0x6d, 0xb9, 0x6e, 0x12, 0x6e, 0x6b, 0x6e, 0xc4,
00619       0x6f, 0x1e, 0x6f, 0x78, 0x6f, 0xd1, 0x70, 0x2b, 0x70, 0x86, 0x70,
00620       0xe0, 0x71, 0x3a, 0x71, 0x95, 0x71, 0xf0, 0x72, 0x4b, 0x72, 0xa6,
00621       0x73, 0x01, 0x73, 0x5d, 0x73, 0xb8, 0x74, 0x14, 0x74, 0x70, 0x74,
00622       0xcc, 0x75, 0x28, 0x75, 0x85, 0x75, 0xe1, 0x76, 0x3e, 0x76, 0x9b,
00623       0x76, 0xf8, 0x77, 0x56, 0x77, 0xb3, 0x78, 0x11, 0x78, 0x6e, 0x78,
00624       0xcc, 0x79, 0x2a, 0x79, 0x89, 0x79, 0xe7, 0x7a, 0x46, 0x7a, 0xa5,
00625       0x7b, 0x04, 0x7b, 0x63, 0x7b, 0xc2, 0x7c, 0x21, 0x7c, 0x81, 0x7c,
00626       0xe1, 0x7d, 0x41, 0x7d, 0xa1, 0x7e, 0x01, 0x7e, 0x62, 0x7e, 0xc2,
00627       0x7f, 0x23, 0x7f, 0x84, 0x7f, 0xe5, 0x80, 0x47, 0x80, 0xa8, 0x81,
00628       0x0a, 0x81, 0x6b, 0x81, 0xcd, 0x82, 0x30, 0x82, 0x92, 0x82, 0xf4,
00629       0x83, 0x57, 0x83, 0xba, 0x84, 0x1d, 0x84, 0x80, 0x84, 0xe3, 0x85,
00630       0x47, 0x85, 0xab, 0x86, 0x0e, 0x86, 0x72, 0x86, 0xd7, 0x87, 0x3b,
00631       0x87, 0x9f, 0x88, 0x04, 0x88, 0x69, 0x88, 0xce, 0x89, 0x33, 0x89,
00632       0x99, 0x89, 0xfe, 0x8a, 0x64, 0x8a, 0xca, 0x8b, 0x30, 0x8b, 0x96,
00633       0x8b, 0xfc, 0x8c, 0x63, 0x8c, 0xca, 0x8d, 0x31, 0x8d, 0x98, 0x8d,
00634       0xff, 0x8e, 0x66, 0x8e, 0xce, 0x8f, 0x36, 0x8f, 0x9e, 0x90, 0x06,
00635       0x90, 0x6e, 0x90, 0xd6, 0x91, 0x3f, 0x91, 0xa8, 0x92, 0x11, 0x92,
00636       0x7a, 0x92, 0xe3, 0x93, 0x4d, 0x93, 0xb6, 0x94, 0x20, 0x94, 0x8a,
00637       0x94, 0xf4, 0x95, 0x5f, 0x95, 0xc9, 0x96, 0x34, 0x96, 0x9f, 0x97,
00638       0x0a, 0x97, 0x75, 0x97, 0xe0, 0x98, 0x4c, 0x98, 0xb8, 0x99, 0x24,
00639       0x99, 0x90, 0x99, 0xfc, 0x9a, 0x68, 0x9a, 0xd5, 0x9b, 0x42, 0x9b,
00640       0xaf, 0x9c, 0x1c, 0x9c, 0x89, 0x9c, 0xf7, 0x9d, 0x64, 0x9d, 0xd2,
00641       0x9e, 0x40, 0x9e, 0xae, 0x9f, 0x1d, 0x9f, 0x8b, 0x9f, 0xfa, 0xa0,
00642       0x69, 0xa0, 0xd8, 0xa1, 0x47, 0xa1, 0xb6, 0xa2, 0x26, 0xa2, 0x96,
00643       0xa3, 0x06, 0xa3, 0x76, 0xa3, 0xe6, 0xa4, 0x56, 0xa4, 0xc7, 0xa5,
00644       0x38, 0xa5, 0xa9, 0xa6, 0x1a, 0xa6, 0x8b, 0xa6, 0xfd, 0xa7, 0x6e,
00645       0xa7, 0xe0, 0xa8, 0x52, 0xa8, 0xc4, 0xa9, 0x37, 0xa9, 0xa9, 0xaa,
00646       0x1c, 0xaa, 0x8f, 0xab, 0x02, 0xab, 0x75, 0xab, 0xe9, 0xac, 0x5c,
00647       0xac, 0xd0, 0xad, 0x44, 0xad, 0xb8, 0xae, 0x2d, 0xae, 0xa1, 0xaf,
00648       0x16, 0xaf, 0x8b, 0xb0, 0x00, 0xb0, 0x75, 0xb0, 0xea, 0xb1, 0x60,
00649       0xb1, 0xd6, 0xb2, 0x4b, 0xb2, 0xc2, 0xb3, 0x38, 0xb3, 0xae, 0xb4,
00650       0x25, 0xb4, 0x9c, 0xb5, 0x13, 0xb5, 0x8a, 0xb6, 0x01, 0xb6, 0x79,
00651       0xb6, 0xf0, 0xb7, 0x68, 0xb7, 0xe0, 0xb8, 0x59, 0xb8, 0xd1, 0xb9,
00652       0x4a, 0xb9, 0xc2, 0xba, 0x3b, 0xba, 0xb5, 0xbb, 0x2e, 0xbb, 0xa7,
00653       0xbc, 0x21, 0xbc, 0x9b, 0xbd, 0x15, 0xbd, 0x8f, 0xbe, 0x0a, 0xbe,
00654       0x84, 0xbe, 0xff, 0xbf, 0x7a, 0xbf, 0xf5, 0xc0, 0x70, 0xc0, 0xec,
00655       0xc1, 0x67, 0xc1, 0xe3, 0xc2, 0x5f, 0xc2, 0xdb, 0xc3, 0x58, 0xc3,
00656       0xd4, 0xc4, 0x51, 0xc4, 0xce, 0xc5, 0x4b, 0xc5, 0xc8, 0xc6, 0x46,
00657       0xc6, 0xc3, 0xc7, 0x41, 0xc7, 0xbf, 0xc8, 0x3d, 0xc8, 0xbc, 0xc9,
00658       0x3a, 0xc9, 0xb9, 0xca, 0x38, 0xca, 0xb7, 0xcb, 0x36, 0xcb, 0xb6,
00659       0xcc, 0x35, 0xcc, 0xb5, 0xcd, 0x35, 0xcd, 0xb5, 0xce, 0x36, 0xce,
00660       0xb6, 0xcf, 0x37, 0xcf, 0xb8, 0xd0, 0x39, 0xd0, 0xba, 0xd1, 0x3c,
00661       0xd1, 0xbe, 0xd2, 0x3f, 0xd2, 0xc1, 0xd3, 0x44, 0xd3, 0xc6, 0xd4,
00662       0x49, 0xd4, 0xcb, 0xd5, 0x4e, 0xd5, 0xd1, 0xd6, 0x55, 0xd6, 0xd8,
00663       0xd7, 0x5c, 0xd7, 0xe0, 0xd8, 0x64, 0xd8, 0xe8, 0xd9, 0x6c, 0xd9,
00664       0xf1, 0xda, 0x76, 0xda, 0xfb, 0xdb, 0x80, 0xdc, 0x05, 0xdc, 0x8a,
00665       0xdd, 0x10, 0xdd, 0x96, 0xde, 0x1c, 0xde, 0xa2, 0xdf, 0x29, 0xdf,
00666       0xaf, 0xe0, 0x36, 0xe0, 0xbd, 0xe1, 0x44, 0xe1, 0xcc, 0xe2, 0x53,
00667       0xe2, 0xdb, 0xe3, 0x63, 0xe3, 0xeb, 0xe4, 0x73, 0xe4, 0xfc, 0xe5,
00668       0x84, 0xe6, 0x0d, 0xe6, 0x96, 0xe7, 0x1f, 0xe7, 0xa9, 0xe8, 0x32,
00669       0xe8, 0xbc, 0xe9, 0x46, 0xe9, 0xd0, 0xea, 0x5b, 0xea, 0xe5, 0xeb,
00670       0x70, 0xeb, 0xfb, 0xec, 0x86, 0xed, 0x11, 0xed, 0x9c, 0xee, 0x28,
00671       0xee, 0xb4, 0xef, 0x40, 0xef, 0xcc, 0xf0, 0x58, 0xf0, 0xe5, 0xf1,
00672       0x72, 0xf1, 0xff, 0xf2, 0x8c, 0xf3, 0x19, 0xf3, 0xa7, 0xf4, 0x34,
00673       0xf4, 0xc2, 0xf5, 0x50, 0xf5, 0xde, 0xf6, 0x6d, 0xf6, 0xfb, 0xf7,
00674       0x8a, 0xf8, 0x19, 0xf8, 0xa8, 0xf9, 0x38, 0xf9, 0xc7, 0xfa, 0x57,
00675       0xfa, 0xe7, 0xfb, 0x77, 0xfc, 0x07, 0xfc, 0x98, 0xfd, 0x29, 0xfd,
00676       0xba, 0xfe, 0x4b, 0xfe, 0xdc, 0xff, 0x6d, 0xff, 0xff
00677     };
00678 
00679   StringInfo
00680     *profile;
00681 
00682   MagickBooleanType
00683     status;
00684 
00685   assert(image != (Image *) NULL);
00686   assert(image->signature == MagickSignature);
00687   if (GetImageProfile(image,"icm") != (const StringInfo *) NULL)
00688     return(MagickFalse);
00689   profile=AcquireStringInfo(sizeof(sRGBProfile));
00690   SetStringInfoDatum(profile,sRGBProfile);
00691   status=SetImageProfile(image,"icm",profile);
00692   profile=DestroyStringInfo(profile);
00693   return(status);
00694 }
00695 #if defined(MAGICKCORE_LCMS_DELEGATE)
00696 #if defined(LCMS_VERSION) && (LCMS_VERSION > 1010)
00697 static int LCMSErrorHandler(int severity,const char *context)
00698 {
00699   (void) LogMagickEvent(TransformEvent,GetMagickModule(),"lcms: #%d, %s",
00700     severity,context != (char *) NULL ? context : "no context");
00701   return(MagickTrue);
00702 }
00703 #endif
00704 #endif
00705 
00706 MagickExport MagickBooleanType ProfileImage(Image *image,const char *name,
00707   const void *datum,const size_t length,
00708   const MagickBooleanType magick_unused(clone))
00709 {
00710 #define ThrowProfileException(severity,tag,context) \
00711 { \
00712   (void) cmsCloseProfile(source_profile); \
00713   (void) cmsCloseProfile(target_profile); \
00714   ThrowBinaryException(severity,tag,context); \
00715 }
00716 
00717   MagickBooleanType
00718     status;
00719 
00720   StringInfo
00721     *profile;
00722 
00723   assert(image != (Image *) NULL);
00724   assert(image->signature == MagickSignature);
00725   if (image->debug != MagickFalse)
00726     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
00727   assert(name != (const char *) NULL);
00728   if ((datum == (const void *) NULL) || (length == 0))
00729     {
00730       if (*name == '*')
00731         {
00732           DestroyImageProfiles(image);
00733           return(MagickTrue);
00734         }
00735       return(DeleteImageProfile(image,name));
00736     }
00737   /*
00738     Add a ICC, IPTC, or generic profile to the image.
00739   */
00740   profile=AcquireStringInfo((size_t) length);
00741   SetStringInfoDatum(profile,(unsigned char *) datum);
00742   if ((LocaleCompare(name,"icc") == 0) || (LocaleCompare(name,"icm") == 0))
00743     {
00744       const StringInfo
00745         *icc_profile;
00746 
00747       icc_profile=GetImageProfile(image,"icc");
00748       if ((icc_profile != (const StringInfo *) NULL) &&
00749           (CompareStringInfo(icc_profile,profile) == 0))
00750         {
00751           const char
00752             *value;
00753 
00754           value=GetImageProperty(image,"exif:ColorSpace");
00755           if (LocaleCompare(value,"1") != 0)
00756             (void) SetsRGBImageProfile(image);
00757           value=GetImageProperty(image,"exif:InteroperabilityIndex");
00758           if (LocaleCompare(value,"R98.") != 0)
00759             (void) SetsRGBImageProfile(image);
00760           value=GetImageProperty(image,"exif:InteroperabilityIndex");
00761           if (LocaleCompare(value,"R03.") != 0)
00762             (void) SetAdobeRGB1998ImageProfile(image);
00763           icc_profile=GetImageProfile(image,"icc");
00764         }
00765       if ((icc_profile != (const StringInfo *) NULL) &&
00766           (CompareStringInfo(icc_profile,profile) == 0))
00767         {
00768           profile=DestroyStringInfo(profile);
00769           return(MagickTrue);
00770         }
00771 #if !defined(MAGICKCORE_LCMS_DELEGATE)
00772       (void) ThrowMagickException(&image->exception,GetMagickModule(),
00773         MissingDelegateWarning,"DelegateLibrarySupportNotBuiltIn","`%s' (LCMS)",
00774         image->filename);
00775 #else
00776       if (icc_profile != (StringInfo *) NULL)
00777         {
00778           ColorspaceType
00779             source_colorspace,
00780             target_colorspace;
00781 
00782           cmsHPROFILE
00783             source_profile,
00784             target_profile;
00785 
00786           cmsHTRANSFORM
00787             transform;
00788 
00789           DWORD
00790             flags,
00791             source_type,
00792             target_type;
00793 
00794           ExceptionInfo
00795             *exception;
00796 
00797           IndexPacket
00798             *indexes;
00799 
00800           int
00801             intent;
00802 
00803           long
00804             y;
00805 
00806           register long
00807             x;
00808 
00809           register PixelPacket
00810             *q;
00811 
00812           register unsigned short
00813             *p;
00814 
00815           size_t
00816             length,
00817             source_channels,
00818             target_channels;
00819 
00820           unsigned short
00821             *source_pixels,
00822             *target_pixels;
00823 
00824           /*
00825             Transform pixel colors as defined by the color profiles.
00826           */
00827 #if defined(LCMS_VERSION) && (LCMS_VERSION > 1010)
00828           cmsSetErrorHandler(LCMSErrorHandler);
00829 #else
00830           (void) cmsErrorAction(LCMS_ERROR_SHOW);
00831 #endif
00832           source_profile=cmsOpenProfileFromMem(GetStringInfoDatum(icc_profile),
00833             (DWORD) GetStringInfoLength(icc_profile));
00834           target_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
00835             (DWORD) GetStringInfoLength(profile));
00836           if ((source_profile == (cmsHPROFILE) NULL) ||
00837               (target_profile == (cmsHPROFILE) NULL))
00838             ThrowBinaryException(ResourceLimitError,
00839               "ColorspaceColorProfileMismatch",name);
00840           switch (cmsGetColorSpace(source_profile))
00841           {
00842             case icSigCmykData:
00843             {
00844               source_colorspace=CMYKColorspace;
00845               source_type=(DWORD) TYPE_CMYK_16;
00846               source_channels=4;
00847               break;
00848             }
00849             case icSigYCbCrData:
00850             {
00851               source_colorspace=YCbCrColorspace;
00852               source_type=(DWORD) TYPE_YCbCr_16;
00853               source_channels=3;
00854               break;
00855             }
00856             case icSigLabData:
00857             {
00858               source_colorspace=LabColorspace;
00859               source_type=(DWORD) TYPE_Lab_16;
00860               source_channels=3;
00861               break;
00862             }
00863             case icSigLuvData:
00864             {
00865               source_colorspace=YUVColorspace;
00866               source_type=(DWORD) TYPE_YUV_16;
00867               source_channels=3;
00868               break;
00869             }
00870             case icSigGrayData:
00871             {
00872               source_colorspace=GRAYColorspace;
00873               source_type=(DWORD) TYPE_GRAY_16;
00874               source_channels=1;
00875               break;
00876             }
00877             case icSigRgbData:
00878             {
00879               source_colorspace=RGBColorspace;
00880               source_type=(DWORD) TYPE_RGB_16;
00881               source_channels=3;
00882               break;
00883             }
00884             default:
00885             {
00886               source_colorspace=UndefinedColorspace;
00887               source_type=(DWORD) TYPE_RGB_16;
00888               source_channels=3;
00889               break;
00890             }
00891           }
00892           switch (cmsGetColorSpace(target_profile))
00893           {
00894             case icSigCmykData:
00895             {
00896               target_colorspace=CMYKColorspace;
00897               target_type=(DWORD) TYPE_CMYK_16;
00898               target_channels=4;
00899               break;
00900             }
00901             case icSigYCbCrData:
00902             {
00903               target_colorspace=YCbCrColorspace;
00904               target_type=(DWORD) TYPE_YCbCr_16;
00905               target_channels=3;
00906               break;
00907             }
00908             case icSigLabData:
00909             {
00910               target_colorspace=LabColorspace;
00911               target_type=(DWORD) TYPE_Lab_16;
00912               target_channels=3;
00913               break;
00914             }
00915             case icSigLuvData:
00916             {
00917               target_colorspace=YUVColorspace;
00918               target_type=(DWORD) TYPE_YUV_16;
00919               target_channels=3;
00920               break;
00921             }
00922             case icSigGrayData:
00923             {
00924               target_colorspace=GRAYColorspace;
00925               target_type=(DWORD) TYPE_GRAY_16;
00926               target_channels=1;
00927               break;
00928             }
00929             case icSigRgbData:
00930             {
00931               target_colorspace=RGBColorspace;
00932               target_type=(DWORD) TYPE_RGB_16;
00933               target_channels=3;
00934               break;
00935             }
00936             default:
00937             {
00938               target_colorspace=UndefinedColorspace;
00939               target_type=(DWORD) TYPE_RGB_16;
00940               target_channels=3;
00941               break;
00942             }
00943           }
00944           exception=(&image->exception);
00945           if (((source_colorspace == UndefinedColorspace) ||
00946                (target_colorspace == UndefinedColorspace)) ||
00947               ((source_colorspace == GRAYColorspace) &&
00948                (!IsGrayImage(image,exception))) ||
00949               ((source_colorspace == CMYKColorspace) &&
00950                (image->colorspace != CMYKColorspace)) ||
00951               ((source_colorspace != GRAYColorspace) &&
00952                (source_colorspace != LabColorspace) &&
00953                (source_colorspace != CMYKColorspace) &&
00954                (image->colorspace != RGBColorspace)))
00955             ThrowProfileException(ImageError,"ColorspaceColorProfileMismatch",
00956               name);
00957           switch (image->rendering_intent)
00958           {
00959             case AbsoluteIntent: intent=INTENT_ABSOLUTE_COLORIMETRIC; break;
00960             case PerceptualIntent: intent=INTENT_PERCEPTUAL; break;
00961             case RelativeIntent: intent=INTENT_RELATIVE_COLORIMETRIC; break;
00962             case SaturationIntent: intent=INTENT_SATURATION; break;
00963             default: intent=INTENT_PERCEPTUAL; break;
00964           }
00965           flags=cmsFLAGS_HIGHRESPRECALC;
00966 #if defined(cmsFLAGS_BLACKPOINTCOMPENSATION)
00967           if (image->black_point_compensation != MagickFalse)
00968             flags|=cmsFLAGS_BLACKPOINTCOMPENSATION;
00969 #endif
00970           transform=cmsCreateTransform(source_profile,source_type,
00971             target_profile,target_type,intent,flags);
00972           (void) cmsCloseProfile(source_profile);
00973           (void) cmsCloseProfile(target_profile);
00974           if (transform == (cmsHTRANSFORM) NULL)
00975             ThrowBinaryException(ImageError,"UnableToCreateColorTransform",
00976               name);
00977           /*
00978             Transform image as dictated by the source and target image profiles.
00979           */
00980           length=(size_t) image->columns;
00981           source_pixels=(unsigned short *) AcquireQuantumMemory(length,
00982             source_channels*sizeof(*source_pixels));
00983           target_pixels=(unsigned short *) AcquireQuantumMemory(length,
00984             target_channels*sizeof(*target_pixels));
00985           if ((source_pixels == (unsigned short *) NULL) ||
00986               (target_pixels == (unsigned short *) NULL))
00987             {
00988               cmsDeleteTransform(transform);
00989               ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
00990                 image->filename);
00991             }
00992           if (SetImageStorageClass(image,DirectClass) == MagickFalse)
00993             return(MagickFalse);
00994           if (target_colorspace == CMYKColorspace)
00995             image->colorspace=target_colorspace;
00996           for (y=0; y < (long) image->rows; y++)
00997           {
00998             q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
00999             if (q == (PixelPacket *) NULL)
01000               break;
01001             p=source_pixels;
01002             indexes=GetAuthenticIndexQueue(image);
01003             for (x=0; x < (long) image->columns; x++)
01004             {
01005               *p++=ScaleQuantumToShort(q->red);
01006               if (source_channels > 1)
01007                 {
01008                   *p++=ScaleQuantumToShort(q->green);
01009                   *p++=ScaleQuantumToShort(q->blue);
01010                 }
01011               if (source_channels > 3)
01012                 *p++=ScaleQuantumToShort(indexes[x]);
01013               q++;
01014             }
01015             cmsDoTransform(transform,source_pixels,target_pixels,(unsigned int)
01016               image->columns);
01017             p=target_pixels;
01018             q-=image->columns;
01019             for (x=0; x < (long) image->columns; x++)
01020             {
01021               q->red=ScaleShortToQuantum(*p);
01022               q->green=q->red;
01023               q->blue=q->red;
01024               p++;
01025               if (target_channels > 1)
01026                 {
01027                   q->green=ScaleShortToQuantum(*p);
01028                   p++;
01029                   q->blue=ScaleShortToQuantum(*p);
01030                   p++;
01031                 }
01032               if (target_channels > 3)
01033                 {
01034                   indexes[x]=ScaleShortToQuantum(*p);
01035                   p++;
01036                 }
01037               q++;
01038             }
01039             if (SyncAuthenticPixels(image,exception) == MagickFalse)
01040               break;
01041           }
01042           image->colorspace=target_colorspace;
01043           switch (cmsGetColorSpace(target_profile))
01044           {
01045             case icSigRgbData:
01046             {
01047               image->type=image->matte == MagickFalse ? TrueColorType :
01048                 TrueColorMatteType;
01049               break;
01050             }
01051             case icSigCmykData:
01052             {
01053               image->type=image->matte == MagickFalse ? ColorSeparationType :
01054                 ColorSeparationMatteType;
01055               break;
01056             }
01057             case icSigGrayData:
01058             {
01059               image->type=image->matte == MagickFalse ? GrayscaleType :
01060                 GrayscaleMatteType;
01061               break;
01062             }
01063             default:
01064               break;
01065           }
01066           target_pixels=(unsigned short *) RelinquishMagickMemory(
01067             target_pixels);
01068           source_pixels=(unsigned short *) RelinquishMagickMemory(
01069             source_pixels);
01070           cmsDeleteTransform(transform);
01071         }
01072 #endif
01073     }
01074   status=SetImageProfile(image,name,profile);
01075   profile=DestroyStringInfo(profile);
01076   return(status);
01077 }
01078 
01079 /*
01080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01081 %                                                                             %
01082 %                                                                             %
01083 %                                                                             %
01084 %   R e m o v e I m a g e P r o f i l e                                       %
01085 %                                                                             %
01086 %                                                                             %
01087 %                                                                             %
01088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01089 %
01090 %  RemoveImageProfile() removes a named profile from the image and returns its
01091 %  value.
01092 %
01093 %  The format of the RemoveImageProfile method is:
01094 %
01095 %      void *RemoveImageProfile(Image *image,const char *name)
01096 %
01097 %  A description of each parameter follows:
01098 %
01099 %    o image: the image.
01100 %
01101 %    o name: the profile name.
01102 %
01103 */
01104 MagickExport StringInfo *RemoveImageProfile(Image *image,const char *name)
01105 {
01106   StringInfo
01107     *profile;
01108 
01109   assert(image != (Image *) NULL);
01110   assert(image->signature == MagickSignature);
01111   if (image->debug != MagickFalse)
01112     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
01113   if (image->profiles == (SplayTreeInfo *) NULL)
01114     return((StringInfo *) NULL);
01115   if (LocaleCompare(name,"icc") == 0)
01116     {
01117       /*
01118         Continue to support deprecated color profile for now.
01119       */
01120       image->color_profile.length=0;
01121       image->color_profile.info=(unsigned char *) NULL;
01122     }
01123   if (LocaleCompare(name,"iptc") == 0)
01124     {
01125       /*
01126         Continue to support deprecated IPTC profile for now.
01127       */
01128       image->iptc_profile.length=0;
01129       image->iptc_profile.info=(unsigned char *) NULL;
01130     }
01131   profile=(StringInfo *) RemoveNodeFromSplayTree((SplayTreeInfo *)
01132     image->profiles,name);
01133   return(profile);
01134 }
01135 
01136 /*
01137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
01138 %