43 #include "magick/studio.h"
44 #include "magick/artifact.h"
45 #include "magick/attribute.h"
46 #include "magick/cache.h"
47 #include "magick/cache-private.h"
48 #include "magick/color.h"
49 #include "magick/colorspace-private.h"
50 #include "magick/compare.h"
51 #include "magick/constitute.h"
52 #include "magick/draw.h"
53 #include "magick/effect.h"
54 #include "magick/exception.h"
55 #include "magick/exception-private.h"
56 #include "magick/fx.h"
57 #include "magick/fx-private.h"
58 #include "magick/gem.h"
59 #include "magick/geometry.h"
60 #include "magick/histogram.h"
61 #include "magick/image.h"
62 #include "magick/image.h"
63 #include "magick/layer.h"
64 #include "magick/list.h"
65 #include "magick/magick.h"
66 #include "magick/memory_.h"
67 #include "magick/monitor.h"
68 #include "magick/montage.h"
69 #include "magick/option.h"
70 #include "magick/policy.h"
71 #include "magick/profile.h"
72 #include "magick/property.h"
73 #include "magick/quantum.h"
74 #include "magick/resource_.h"
75 #include "magick/splay-tree.h"
76 #include "magick/signature-private.h"
77 #include "magick/statistic.h"
78 #include "magick/string_.h"
79 #include "magick/string-private.h"
80 #include "magick/token.h"
81 #include "magick/utility.h"
82 #include "magick/version.h"
83 #include "magick/xml-tree.h"
84 #if defined(MAGICKCORE_LCMS_DELEGATE)
85 #if defined(MAGICKCORE_HAVE_LCMS2_LCMS2_H)
86 #include <lcms2/lcms2.h>
87 #elif defined(MAGICKCORE_HAVE_LCMS2_H)
89 #elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
90 #include <lcms/lcms.h>
99 #if defined(MAGICKCORE_LCMS_DELEGATE)
100 #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
101 #define cmsUInt32Number DWORD
130 MagickExport MagickBooleanType CloneImageProperties(
Image *image,
131 const Image *clone_image)
133 assert(image != (
Image *) NULL);
134 assert(image->signature == MagickCoreSignature);
135 assert(clone_image != (
const Image *) NULL);
136 assert(clone_image->signature == MagickCoreSignature);
137 if (IsEventLogging() != MagickFalse)
139 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
140 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
141 clone_image->filename);
143 (void) CopyMagickString(image->filename,clone_image->filename,MaxTextExtent);
144 (void) CopyMagickString(image->magick_filename,clone_image->magick_filename,
146 image->compression=clone_image->compression;
147 image->quality=clone_image->quality;
148 image->depth=clone_image->depth;
149 image->background_color=clone_image->background_color;
150 image->border_color=clone_image->border_color;
151 image->matte_color=clone_image->matte_color;
152 image->transparent_color=clone_image->transparent_color;
153 image->gamma=clone_image->gamma;
154 image->chromaticity=clone_image->chromaticity;
155 image->rendering_intent=clone_image->rendering_intent;
156 image->black_point_compensation=clone_image->black_point_compensation;
157 image->units=clone_image->units;
158 image->montage=(
char *) NULL;
159 image->directory=(
char *) NULL;
160 (void) CloneString(&image->geometry,clone_image->geometry);
161 image->offset=clone_image->offset;
162 image->x_resolution=clone_image->x_resolution;
163 image->y_resolution=clone_image->y_resolution;
164 image->page=clone_image->page;
165 image->tile_offset=clone_image->tile_offset;
166 image->extract_info=clone_image->extract_info;
167 image->bias=clone_image->bias;
168 image->filter=clone_image->filter;
169 image->blur=clone_image->blur;
170 image->fuzz=clone_image->fuzz;
171 image->intensity=clone_image->intensity;
172 image->interlace=clone_image->interlace;
173 image->interpolate=clone_image->interpolate;
174 image->endian=clone_image->endian;
175 image->gravity=clone_image->gravity;
176 image->compose=clone_image->compose;
177 image->orientation=clone_image->orientation;
178 image->scene=clone_image->scene;
179 image->dispose=clone_image->dispose;
180 image->delay=clone_image->delay;
181 image->ticks_per_second=clone_image->ticks_per_second;
182 image->iterations=clone_image->iterations;
183 image->total_colors=clone_image->total_colors;
184 image->taint=clone_image->taint;
185 image->progress_monitor=clone_image->progress_monitor;
186 image->client_data=clone_image->client_data;
187 image->start_loop=clone_image->start_loop;
188 image->error=clone_image->error;
189 image->signature=clone_image->signature;
190 if (clone_image->properties != (
void *) NULL)
192 if (image->properties != (
void *) NULL)
193 DestroyImageProperties(image);
195 clone_image->properties,(
void *(*)(
void *)) ConstantString,
196 (
void *(*)(
void *)) ConstantString);
228 MagickExport MagickBooleanType DefineImageProperty(
Image *image,
229 const char *property)
233 value[MaxTextExtent];
238 assert(image != (
Image *) NULL);
239 assert(property != (
const char *) NULL);
240 (void) CopyMagickString(key,property,MaxTextExtent-1);
241 for (p=key; *p !=
'\0'; p++)
246 (void) CopyMagickString(value,p+1,MaxTextExtent);
248 return(SetImageProperty(image,key,value));
275 MagickExport MagickBooleanType DeleteImageProperty(
Image *image,
276 const char *property)
278 assert(image != (
Image *) NULL);
279 assert(image->signature == MagickCoreSignature);
280 if (IsEventLogging() != MagickFalse)
281 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
282 if (image->properties == (
void *) NULL)
284 return(DeleteNodeFromSplayTree((
SplayTreeInfo *) image->properties,property));
310 MagickExport
void DestroyImageProperties(
Image *image)
312 assert(image != (
Image *) NULL);
313 assert(image->signature == MagickCoreSignature);
314 if (IsEventLogging() != MagickFalse)
315 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
316 if (image->properties != (
void *) NULL)
317 image->properties=(
void *) DestroySplayTree((
SplayTreeInfo *)
350 MagickExport MagickBooleanType FormatImageProperty(
Image *image,
351 const char *property,
const char *format,...)
354 value[MaxTextExtent];
362 va_start(operands,format);
363 n=FormatLocaleStringList(value,MaxTextExtent,format,operands);
366 return(SetImageProperty(image,property,value));
402 *TracePSClippath(
const unsigned char *,
size_t,
const size_t,
404 *TraceSVGClippath(
const unsigned char *,
size_t,
const size_t,
407 static MagickBooleanType GetIPTCProperty(
const Image *image,
const char *key)
427 profile=GetImageProfile(image,
"iptc");
429 profile=GetImageProfile(image,
"8bim");
432 count=sscanf(key,
"IPTC:%ld:%ld",&dataset,&record);
435 attribute=(
char *) NULL;
436 for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=(ssize_t) length)
439 if ((ssize_t) GetStringInfoDatum(profile)[i] != 0x1c)
441 length=(size_t) (GetStringInfoDatum(profile)[i+3] << 8);
442 length|=GetStringInfoDatum(profile)[i+4];
443 if (((
long) GetStringInfoDatum(profile)[i+1] == dataset) &&
444 ((
long) GetStringInfoDatum(profile)[i+2] == record))
446 message=(
char *) NULL;
448 message=(
char *) AcquireQuantumMemory(length+1UL,
sizeof(*message));
449 if (message != (
char *) NULL)
451 (void) CopyMagickString(message,(
char *) GetStringInfoDatum(
452 profile)+i+5,length+1);
453 (void) ConcatenateString(&attribute,message);
454 (void) ConcatenateString(&attribute,
";");
455 message=DestroyString(message);
460 if ((attribute == (
char *) NULL) || (*attribute ==
';'))
462 if (attribute != (
char *) NULL)
463 attribute=DestroyString(attribute);
466 attribute[strlen(attribute)-1]=
'\0';
467 (void) SetImageProperty((
Image *) image,key,(
const char *) attribute);
468 attribute=DestroyString(attribute);
472 static inline int ReadPropertyByte(
const unsigned char **p,
size_t *length)
484 static inline signed int ReadPropertyMSBLong(
const unsigned char **p,
510 for (i=0; i < 4; i++)
514 buffer[i]=(
unsigned char) c;
516 value=(
unsigned int) buffer[0] << 24;
517 value|=(
unsigned int) buffer[1] << 16;
518 value|=(
unsigned int) buffer[2] << 8;
519 value|=(
unsigned int) buffer[3];
520 quantum.unsigned_value=value & 0xffffffff;
521 return(quantum.signed_value);
524 static inline signed short ReadPropertyMSBShort(
const unsigned char **p,
549 return((
unsigned short) ~0);
550 for (i=0; i < 2; i++)
554 buffer[i]=(
unsigned char) c;
556 value=(
unsigned short) buffer[0] << 8;
557 value|=(
unsigned short) buffer[1];
558 quantum.unsigned_value=value & 0xffff;
559 return(quantum.signed_value);
562 static MagickBooleanType Get8BIMProperty(
const Image *image,
const char *key)
566 format[MaxTextExtent],
597 profile=GetImageProfile(image,
"8bim");
600 count=(ssize_t) sscanf(key,
"8BIM:%ld,%ld:%1024[^\n]\n%1024[^\n]",&start,&stop,
602 if ((count != 2) && (count != 3) && (count != 4))
605 (void) CopyMagickString(format,
"SVG",MaxTextExtent);
610 sub_number=(ssize_t) StringToLong(&name[1]);
611 sub_number=MagickMax(sub_number,1L);
612 resource=(
char *) NULL;
614 length=GetStringInfoLength(profile);
615 info=GetStringInfoDatum(profile);
616 while ((length > 0) && (status == MagickFalse))
618 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'8')
620 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'B')
622 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'I')
624 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'M')
626 id=(ssize_t) ReadPropertyMSBShort(&info,&length);
627 if (
id < (ssize_t) start)
629 if (
id > (ssize_t) stop)
631 if (resource != (
char *) NULL)
632 resource=DestroyString(resource);
633 count=(ssize_t) ReadPropertyByte(&info,&length);
634 if ((count != 0) && ((size_t) count <= length))
636 resource=(
char *) NULL;
637 if (~((
size_t) count) >= (MaxTextExtent-1))
638 resource=(
char *) AcquireQuantumMemory((
size_t) count+MaxTextExtent,
640 if (resource != (
char *) NULL)
642 for (i=0; i < (ssize_t) count; i++)
643 resource[i]=(
char) ReadPropertyByte(&info,&length);
644 resource[count]=
'\0';
647 if ((count & 0x01) == 0)
648 (void) ReadPropertyByte(&info,&length);
649 count=(ssize_t) ReadPropertyMSBLong(&info,&length);
650 if ((count < 0) || ((size_t) count > length))
655 if ((*name !=
'\0') && (*name !=
'#'))
656 if ((resource == (
char *) NULL) || (LocaleCompare(name,resource) != 0))
662 length-=MagickMin(count,(ssize_t) length);
665 if ((*name ==
'#') && (sub_number != 1))
672 length-=MagickMin(count,(ssize_t) length);
678 attribute=(
char *) NULL;
679 if (~((
size_t) count) >= (MaxTextExtent-1))
680 attribute=(
char *) AcquireQuantumMemory((
size_t) count+MaxTextExtent,
682 if (attribute != (
char *) NULL)
684 (void) memcpy(attribute,(
char *) info,(size_t) count);
685 attribute[count]=
'\0';
687 length-=MagickMin(count,(ssize_t) length);
688 if ((
id <= 1999) || (
id >= 2999))
689 (void) SetImageProperty((
Image *) image,key,(
const char *) attribute);
695 if (LocaleCompare(format,
"svg") == 0)
696 path=TraceSVGClippath((
unsigned char *) attribute,(size_t) count,
697 image->columns,image->rows);
699 path=TracePSClippath((
unsigned char *) attribute,(
size_t) count,
700 image->columns,image->rows);
701 (void) SetImageProperty((
Image *) image,key,(
const char *) path);
702 path=DestroyString(path);
704 attribute=DestroyString(attribute);
708 if (resource != (
char *) NULL)
709 resource=DestroyString(resource);
713 static inline signed int ReadPropertySignedLong(
const EndianType endian,
714 const unsigned char *buffer)
728 if (endian == LSBEndian)
730 value=(
unsigned int) buffer[3] << 24;
731 value|=(
unsigned int) buffer[2] << 16;
732 value|=(
unsigned int) buffer[1] << 8;
733 value|=(
unsigned int) buffer[0];
734 quantum.unsigned_value=value & 0xffffffff;
735 return(quantum.signed_value);
737 value=(
unsigned int) buffer[0] << 24;
738 value|=(
unsigned int) buffer[1] << 16;
739 value|=(
unsigned int) buffer[2] << 8;
740 value|=(
unsigned int) buffer[3];
741 quantum.unsigned_value=value & 0xffffffff;
742 return(quantum.signed_value);
745 static inline unsigned int ReadPropertyUnsignedLong(
const EndianType endian,
746 const unsigned char *buffer)
751 if (endian == LSBEndian)
753 value=(
unsigned int) buffer[3] << 24;
754 value|=(
unsigned int) buffer[2] << 16;
755 value|=(
unsigned int) buffer[1] << 8;
756 value|=(
unsigned int) buffer[0];
757 return(value & 0xffffffff);
759 value=(
unsigned int) buffer[0] << 24;
760 value|=(
unsigned int) buffer[1] << 16;
761 value|=(
unsigned int) buffer[2] << 8;
762 value|=(
unsigned int) buffer[3];
763 return(value & 0xffffffff);
766 static inline signed short ReadPropertySignedShort(
const EndianType endian,
767 const unsigned char *buffer)
781 if (endian == LSBEndian)
783 value=(
unsigned short) buffer[1] << 8;
784 value|=(
unsigned short) buffer[0];
785 quantum.unsigned_value=value & 0xffff;
786 return(quantum.signed_value);
788 value=(
unsigned short) buffer[0] << 8;
789 value|=(
unsigned short) buffer[1];
790 quantum.unsigned_value=value & 0xffff;
791 return(quantum.signed_value);
794 static inline unsigned short ReadPropertyUnsignedShort(
const EndianType endian,
795 const unsigned char *buffer)
800 if (endian == LSBEndian)
802 value=(
unsigned short) buffer[1] << 8;
803 value|=(
unsigned short) buffer[0];
804 return(value & 0xffff);
806 value=(
unsigned short) buffer[0] << 8;
807 value|=(
unsigned short) buffer[1];
808 return(value & 0xffff);
811 static MagickBooleanType GetEXIFProperty(
const Image *image,
812 const char *property)
814 #define MaxDirectoryStack 16
815 #define EXIF_DELIMITER "\n"
816 #define EXIF_NUM_FORMATS 12
817 #define EXIF_FMT_BYTE 1
818 #define EXIF_FMT_STRING 2
819 #define EXIF_FMT_USHORT 3
820 #define EXIF_FMT_ULONG 4
821 #define EXIF_FMT_URATIONAL 5
822 #define EXIF_FMT_SBYTE 6
823 #define EXIF_FMT_UNDEFINED 7
824 #define EXIF_FMT_SSHORT 8
825 #define EXIF_FMT_SLONG 9
826 #define EXIF_FMT_SRATIONAL 10
827 #define EXIF_FMT_SINGLE 11
828 #define EXIF_FMT_DOUBLE 12
829 #define GPS_LATITUDE 0x10002
830 #define GPS_LONGITUDE 0x10004
831 #define GPS_TIMESTAMP 0x10007
832 #define TAG_EXIF_OFFSET 0x8769
833 #define TAG_GPS_OFFSET 0x8825
834 #define TAG_INTEROP_OFFSET 0xa005
836 #define EXIFGPSFractions(format,arg1,arg2,arg3,arg4,arg5,arg6) \
844 for ( ; component < components; component++) \
846 extent=(size_t) ((ssize_t) extent+FormatLocaleString(buffer+extent, \
847 MagickPathExtent-extent,format", ",(arg1),(arg2),(arg3),(arg4),(arg5), \
849 if (extent >= (MagickPathExtent-1)) \
850 extent=MagickPathExtent-1; \
853 buffer[extent-2]='\0'; \
854 value=AcquireString(buffer); \
857 #define EXIFMultipleValues(format,arg) \
866 for (component=0; component < components; component++) \
868 length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
870 if (length >= (MaxTextExtent-1)) \
871 length=MaxTextExtent-1; \
874 buffer[length-2]='\0'; \
875 value=AcquireString(buffer); \
878 #define EXIFMultipleFractions(format,arg1,arg2) \
887 for (component=0; component < components; component++) \
889 length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
890 format", ",(arg1),(arg2)); \
891 if (length >= (MaxTextExtent-1)) \
892 length=MaxTextExtent-1; \
895 buffer[length-2]='\0'; \
896 value=AcquireString(buffer); \
899 typedef struct _DirectoryInfo
911 typedef struct _TagInfo
923 { 0x001,
"exif:InteroperabilityIndex" },
924 { 0x002,
"exif:InteroperabilityVersion" },
925 { 0x100,
"exif:ImageWidth" },
926 { 0x101,
"exif:ImageLength" },
927 { 0x102,
"exif:BitsPerSample" },
928 { 0x103,
"exif:Compression" },
929 { 0x106,
"exif:PhotometricInterpretation" },
930 { 0x10a,
"exif:FillOrder" },
931 { 0x10d,
"exif:DocumentName" },
932 { 0x10e,
"exif:ImageDescription" },
933 { 0x10f,
"exif:Make" },
934 { 0x110,
"exif:Model" },
935 { 0x111,
"exif:StripOffsets" },
936 { 0x112,
"exif:Orientation" },
937 { 0x115,
"exif:SamplesPerPixel" },
938 { 0x116,
"exif:RowsPerStrip" },
939 { 0x117,
"exif:StripByteCounts" },
940 { 0x11a,
"exif:XResolution" },
941 { 0x11b,
"exif:YResolution" },
942 { 0x11c,
"exif:PlanarConfiguration" },
943 { 0x11d,
"exif:PageName" },
944 { 0x11e,
"exif:XPosition" },
945 { 0x11f,
"exif:YPosition" },
946 { 0x118,
"exif:MinSampleValue" },
947 { 0x119,
"exif:MaxSampleValue" },
948 { 0x120,
"exif:FreeOffsets" },
949 { 0x121,
"exif:FreeByteCounts" },
950 { 0x122,
"exif:GrayResponseUnit" },
951 { 0x123,
"exif:GrayResponseCurve" },
952 { 0x124,
"exif:T4Options" },
953 { 0x125,
"exif:T6Options" },
954 { 0x128,
"exif:ResolutionUnit" },
955 { 0x12d,
"exif:TransferFunction" },
956 { 0x131,
"exif:Software" },
957 { 0x132,
"exif:DateTime" },
958 { 0x13b,
"exif:Artist" },
959 { 0x13e,
"exif:WhitePoint" },
960 { 0x13f,
"exif:PrimaryChromaticities" },
961 { 0x140,
"exif:ColorMap" },
962 { 0x141,
"exif:HalfToneHints" },
963 { 0x142,
"exif:TileWidth" },
964 { 0x143,
"exif:TileLength" },
965 { 0x144,
"exif:TileOffsets" },
966 { 0x145,
"exif:TileByteCounts" },
967 { 0x14a,
"exif:SubIFD" },
968 { 0x14c,
"exif:InkSet" },
969 { 0x14d,
"exif:InkNames" },
970 { 0x14e,
"exif:NumberOfInks" },
971 { 0x150,
"exif:DotRange" },
972 { 0x151,
"exif:TargetPrinter" },
973 { 0x152,
"exif:ExtraSample" },
974 { 0x153,
"exif:SampleFormat" },
975 { 0x154,
"exif:SMinSampleValue" },
976 { 0x155,
"exif:SMaxSampleValue" },
977 { 0x156,
"exif:TransferRange" },
978 { 0x157,
"exif:ClipPath" },
979 { 0x158,
"exif:XClipPathUnits" },
980 { 0x159,
"exif:YClipPathUnits" },
981 { 0x15a,
"exif:Indexed" },
982 { 0x15b,
"exif:JPEGTables" },
983 { 0x15f,
"exif:OPIProxy" },
984 { 0x200,
"exif:JPEGProc" },
985 { 0x201,
"exif:JPEGInterchangeFormat" },
986 { 0x202,
"exif:JPEGInterchangeFormatLength" },
987 { 0x203,
"exif:JPEGRestartInterval" },
988 { 0x205,
"exif:JPEGLosslessPredictors" },
989 { 0x206,
"exif:JPEGPointTransforms" },
990 { 0x207,
"exif:JPEGQTables" },
991 { 0x208,
"exif:JPEGDCTables" },
992 { 0x209,
"exif:JPEGACTables" },
993 { 0x211,
"exif:YCbCrCoefficients" },
994 { 0x212,
"exif:YCbCrSubSampling" },
995 { 0x213,
"exif:YCbCrPositioning" },
996 { 0x214,
"exif:ReferenceBlackWhite" },
997 { 0x2bc,
"exif:ExtensibleMetadataPlatform" },
998 { 0x301,
"exif:Gamma" },
999 { 0x302,
"exif:ICCProfileDescriptor" },
1000 { 0x303,
"exif:SRGBRenderingIntent" },
1001 { 0x320,
"exif:ImageTitle" },
1002 { 0x5001,
"exif:ResolutionXUnit" },
1003 { 0x5002,
"exif:ResolutionYUnit" },
1004 { 0x5003,
"exif:ResolutionXLengthUnit" },
1005 { 0x5004,
"exif:ResolutionYLengthUnit" },
1006 { 0x5005,
"exif:PrintFlags" },
1007 { 0x5006,
"exif:PrintFlagsVersion" },
1008 { 0x5007,
"exif:PrintFlagsCrop" },
1009 { 0x5008,
"exif:PrintFlagsBleedWidth" },
1010 { 0x5009,
"exif:PrintFlagsBleedWidthScale" },
1011 { 0x500A,
"exif:HalftoneLPI" },
1012 { 0x500B,
"exif:HalftoneLPIUnit" },
1013 { 0x500C,
"exif:HalftoneDegree" },
1014 { 0x500D,
"exif:HalftoneShape" },
1015 { 0x500E,
"exif:HalftoneMisc" },
1016 { 0x500F,
"exif:HalftoneScreen" },
1017 { 0x5010,
"exif:JPEGQuality" },
1018 { 0x5011,
"exif:GridSize" },
1019 { 0x5012,
"exif:ThumbnailFormat" },
1020 { 0x5013,
"exif:ThumbnailWidth" },
1021 { 0x5014,
"exif:ThumbnailHeight" },
1022 { 0x5015,
"exif:ThumbnailColorDepth" },
1023 { 0x5016,
"exif:ThumbnailPlanes" },
1024 { 0x5017,
"exif:ThumbnailRawBytes" },
1025 { 0x5018,
"exif:ThumbnailSize" },
1026 { 0x5019,
"exif:ThumbnailCompressedSize" },
1027 { 0x501a,
"exif:ColorTransferFunction" },
1028 { 0x501b,
"exif:ThumbnailData" },
1029 { 0x5020,
"exif:ThumbnailImageWidth" },
1030 { 0x5021,
"exif:ThumbnailImageHeight" },
1031 { 0x5022,
"exif:ThumbnailBitsPerSample" },
1032 { 0x5023,
"exif:ThumbnailCompression" },
1033 { 0x5024,
"exif:ThumbnailPhotometricInterp" },
1034 { 0x5025,
"exif:ThumbnailImageDescription" },
1035 { 0x5026,
"exif:ThumbnailEquipMake" },
1036 { 0x5027,
"exif:ThumbnailEquipModel" },
1037 { 0x5028,
"exif:ThumbnailStripOffsets" },
1038 { 0x5029,
"exif:ThumbnailOrientation" },
1039 { 0x502a,
"exif:ThumbnailSamplesPerPixel" },
1040 { 0x502b,
"exif:ThumbnailRowsPerStrip" },
1041 { 0x502c,
"exif:ThumbnailStripBytesCount" },
1042 { 0x502d,
"exif:ThumbnailResolutionX" },
1043 { 0x502e,
"exif:ThumbnailResolutionY" },
1044 { 0x502f,
"exif:ThumbnailPlanarConfig" },
1045 { 0x5030,
"exif:ThumbnailResolutionUnit" },
1046 { 0x5031,
"exif:ThumbnailTransferFunction" },
1047 { 0x5032,
"exif:ThumbnailSoftwareUsed" },
1048 { 0x5033,
"exif:ThumbnailDateTime" },
1049 { 0x5034,
"exif:ThumbnailArtist" },
1050 { 0x5035,
"exif:ThumbnailWhitePoint" },
1051 { 0x5036,
"exif:ThumbnailPrimaryChromaticities" },
1052 { 0x5037,
"exif:ThumbnailYCbCrCoefficients" },
1053 { 0x5038,
"exif:ThumbnailYCbCrSubsampling" },
1054 { 0x5039,
"exif:ThumbnailYCbCrPositioning" },
1055 { 0x503A,
"exif:ThumbnailRefBlackWhite" },
1056 { 0x503B,
"exif:ThumbnailCopyRight" },
1057 { 0x5090,
"exif:LuminanceTable" },
1058 { 0x5091,
"exif:ChrominanceTable" },
1059 { 0x5100,
"exif:FrameDelay" },
1060 { 0x5101,
"exif:LoopCount" },
1061 { 0x5110,
"exif:PixelUnit" },
1062 { 0x5111,
"exif:PixelPerUnitX" },
1063 { 0x5112,
"exif:PixelPerUnitY" },
1064 { 0x5113,
"exif:PaletteHistogram" },
1065 { 0x1000,
"exif:RelatedImageFileFormat" },
1066 { 0x1001,
"exif:RelatedImageLength" },
1067 { 0x1002,
"exif:RelatedImageWidth" },
1068 { 0x800d,
"exif:ImageID" },
1069 { 0x80e3,
"exif:Matteing" },
1070 { 0x80e4,
"exif:DataType" },
1071 { 0x80e5,
"exif:ImageDepth" },
1072 { 0x80e6,
"exif:TileDepth" },
1073 { 0x828d,
"exif:CFARepeatPatternDim" },
1074 { 0x828e,
"exif:CFAPattern2" },
1075 { 0x828f,
"exif:BatteryLevel" },
1076 { 0x8298,
"exif:Copyright" },
1077 { 0x829a,
"exif:ExposureTime" },
1078 { 0x829d,
"exif:FNumber" },
1079 { 0x83bb,
"exif:IPTC/NAA" },
1080 { 0x84e3,
"exif:IT8RasterPadding" },
1081 { 0x84e5,
"exif:IT8ColorTable" },
1082 { 0x8649,
"exif:ImageResourceInformation" },
1083 { 0x8769,
"exif:ExifOffset" },
1084 { 0x8773,
"exif:InterColorProfile" },
1085 { 0x8822,
"exif:ExposureProgram" },
1086 { 0x8824,
"exif:SpectralSensitivity" },
1087 { 0x8825,
"exif:GPSInfo" },
1088 { 0x8827,
"exif:PhotographicSensitivity" },
1089 { 0x8828,
"exif:OECF" },
1090 { 0x8829,
"exif:Interlace" },
1091 { 0x882a,
"exif:TimeZoneOffset" },
1092 { 0x882b,
"exif:SelfTimerMode" },
1093 { 0x8830,
"exif:SensitivityType" },
1094 { 0x8831,
"exif:StandardOutputSensitivity" },
1095 { 0x8832,
"exif:RecommendedExposureIndex" },
1096 { 0x8833,
"exif:ISOSpeed" },
1097 { 0x8834,
"exif:ISOSpeedLatitudeyyy" },
1098 { 0x8835,
"exif:ISOSpeedLatitudezzz" },
1099 { 0x9000,
"exif:ExifVersion" },
1100 { 0x9003,
"exif:DateTimeOriginal" },
1101 { 0x9004,
"exif:DateTimeDigitized" },
1102 { 0x9010,
"exif:OffsetTime" },
1103 { 0x9011,
"exif:OffsetTimeOriginal" },
1104 { 0x9012,
"exif:OffsetTimeDigitized" },
1105 { 0x9101,
"exif:ComponentsConfiguration" },
1106 { 0x9102,
"exif:CompressedBitsPerPixel" },
1107 { 0x9201,
"exif:ShutterSpeedValue" },
1108 { 0x9202,
"exif:ApertureValue" },
1109 { 0x9203,
"exif:BrightnessValue" },
1110 { 0x9204,
"exif:ExposureBiasValue" },
1111 { 0x9205,
"exif:MaxApertureValue" },
1112 { 0x9206,
"exif:SubjectDistance" },
1113 { 0x9207,
"exif:MeteringMode" },
1114 { 0x9208,
"exif:LightSource" },
1115 { 0x9209,
"exif:Flash" },
1116 { 0x920a,
"exif:FocalLength" },
1117 { 0x920b,
"exif:FlashEnergy" },
1118 { 0x920c,
"exif:SpatialFrequencyResponse" },
1119 { 0x920d,
"exif:Noise" },
1120 { 0x9214,
"exif:SubjectArea" },
1121 { 0x9290,
"exif:SubSecTime" },
1122 { 0x9291,
"exif:SubSecTimeOriginal" },
1123 { 0x9292,
"exif:SubSecTimeDigitized" },
1124 { 0x9211,
"exif:ImageNumber" },
1125 { 0x9212,
"exif:SecurityClassification" },
1126 { 0x9213,
"exif:ImageHistory" },
1127 { 0x9214,
"exif:SubjectArea" },
1128 { 0x9215,
"exif:ExposureIndex" },
1129 { 0x9216,
"exif:TIFF-EPStandardID" },
1130 { 0x927c,
"exif:MakerNote" },
1131 { 0x9286,
"exif:UserComment" },
1132 { 0x9290,
"exif:SubSecTime" },
1133 { 0x9291,
"exif:SubSecTimeOriginal" },
1134 { 0x9292,
"exif:SubSecTimeDigitized" },
1135 { 0x9400,
"exif:Temperature" },
1136 { 0x9401,
"exif:Humidity" },
1137 { 0x9402,
"exif:Pressure" },
1138 { 0x9403,
"exif:WaterDepth" },
1139 { 0x9404,
"exif:Acceleration" },
1140 { 0x9405,
"exif:CameraElevationAngle" },
1141 { 0x9C9b,
"exif:WinXP-Title" },
1142 { 0x9C9c,
"exif:WinXP-Comments" },
1143 { 0x9C9d,
"exif:WinXP-Author" },
1144 { 0x9C9e,
"exif:WinXP-Keywords" },
1145 { 0x9C9f,
"exif:WinXP-Subject" },
1146 { 0xa000,
"exif:FlashPixVersion" },
1147 { 0xa001,
"exif:ColorSpace" },
1148 { 0xa002,
"exif:PixelXDimension" },
1149 { 0xa003,
"exif:PixelYDimension" },
1150 { 0xa004,
"exif:RelatedSoundFile" },
1151 { 0xa005,
"exif:InteroperabilityOffset" },
1152 { 0xa20b,
"exif:FlashEnergy" },
1153 { 0xa20c,
"exif:SpatialFrequencyResponse" },
1154 { 0xa20d,
"exif:Noise" },
1155 { 0xa20e,
"exif:FocalPlaneXResolution" },
1156 { 0xa20f,
"exif:FocalPlaneYResolution" },
1157 { 0xa210,
"exif:FocalPlaneResolutionUnit" },
1158 { 0xa214,
"exif:SubjectLocation" },
1159 { 0xa215,
"exif:ExposureIndex" },
1160 { 0xa216,
"exif:TIFF/EPStandardID" },
1161 { 0xa217,
"exif:SensingMethod" },
1162 { 0xa300,
"exif:FileSource" },
1163 { 0xa301,
"exif:SceneType" },
1164 { 0xa302,
"exif:CFAPattern" },
1165 { 0xa401,
"exif:CustomRendered" },
1166 { 0xa402,
"exif:ExposureMode" },
1167 { 0xa403,
"exif:WhiteBalance" },
1168 { 0xa404,
"exif:DigitalZoomRatio" },
1169 { 0xa405,
"exif:FocalLengthIn35mmFilm" },
1170 { 0xa406,
"exif:SceneCaptureType" },
1171 { 0xa407,
"exif:GainControl" },
1172 { 0xa408,
"exif:Contrast" },
1173 { 0xa409,
"exif:Saturation" },
1174 { 0xa40a,
"exif:Sharpness" },
1175 { 0xa40b,
"exif:DeviceSettingDescription" },
1176 { 0xa40c,
"exif:SubjectDistanceRange" },
1177 { 0xa420,
"exif:ImageUniqueID" },
1178 { 0xa430,
"exif:CameraOwnerName" },
1179 { 0xa431,
"exif:BodySerialNumber" },
1180 { 0xa432,
"exif:LensSpecification" },
1181 { 0xa433,
"exif:LensMake" },
1182 { 0xa434,
"exif:LensModel" },
1183 { 0xa435,
"exif:LensSerialNumber" },
1184 { 0xc4a5,
"exif:PrintImageMatching" },
1185 { 0xa500,
"exif:Gamma" },
1186 { 0xc640,
"exif:CR2Slice" },
1187 { 0x10000,
"exif:GPSVersionID" },
1188 { 0x10001,
"exif:GPSLatitudeRef" },
1189 { 0x10002,
"exif:GPSLatitude" },
1190 { 0x10003,
"exif:GPSLongitudeRef" },
1191 { 0x10004,
"exif:GPSLongitude" },
1192 { 0x10005,
"exif:GPSAltitudeRef" },
1193 { 0x10006,
"exif:GPSAltitude" },
1194 { 0x10007,
"exif:GPSTimeStamp" },
1195 { 0x10008,
"exif:GPSSatellites" },
1196 { 0x10009,
"exif:GPSStatus" },
1197 { 0x1000a,
"exif:GPSMeasureMode" },
1198 { 0x1000b,
"exif:GPSDop" },
1199 { 0x1000c,
"exif:GPSSpeedRef" },
1200 { 0x1000d,
"exif:GPSSpeed" },
1201 { 0x1000e,
"exif:GPSTrackRef" },
1202 { 0x1000f,
"exif:GPSTrack" },
1203 { 0x10010,
"exif:GPSImgDirectionRef" },
1204 { 0x10011,
"exif:GPSImgDirection" },
1205 { 0x10012,
"exif:GPSMapDatum" },
1206 { 0x10013,
"exif:GPSDestLatitudeRef" },
1207 { 0x10014,
"exif:GPSDestLatitude" },
1208 { 0x10015,
"exif:GPSDestLongitudeRef" },
1209 { 0x10016,
"exif:GPSDestLongitude" },
1210 { 0x10017,
"exif:GPSDestBearingRef" },
1211 { 0x10018,
"exif:GPSDestBearing" },
1212 { 0x10019,
"exif:GPSDestDistanceRef" },
1213 { 0x1001a,
"exif:GPSDestDistance" },
1214 { 0x1001b,
"exif:GPSProcessingMethod" },
1215 { 0x1001c,
"exif:GPSAreaInformation" },
1216 { 0x1001d,
"exif:GPSDateStamp" },
1217 { 0x1001e,
"exif:GPSDifferential" },
1218 { 0x1001f,
"exif:GPSHPositioningError" },
1230 directory_stack[MaxDirectoryStack] = { { 0, 0, 0 } };
1259 tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
1264 profile=GetImageProfile(image,
"exif");
1266 return(MagickFalse);
1267 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1268 return(MagickFalse);
1269 while (isspace((
int) ((
unsigned char) *property)) != 0)
1271 if (strlen(property) <= 5)
1272 return(MagickFalse);
1275 switch (*(property+5))
1304 tag=(*(
property+5) ==
'@') ? 1UL : 0UL;
1308 return(MagickFalse);
1315 for (i=(ssize_t) n-1L; i >= 0; i--)
1319 if ((c >=
'0') && (c <=
'9'))
1322 if ((c >=
'A') && (c <=
'F'))
1325 if ((c >=
'a') && (c <=
'f'))
1328 return(MagickFalse);
1330 }
while (*property !=
'\0');
1340 if (EXIFTag[i].tag == 0)
1342 if (LocaleCompare(EXIFTag[i].description,property) == 0)
1344 tag=(size_t) EXIFTag[i].tag;
1352 return(MagickFalse);
1353 length=GetStringInfoLength(profile);
1355 return(MagickFalse);
1356 exif=GetStringInfoDatum(profile);
1359 if (ReadPropertyByte(&exif,&length) != 0x45)
1361 if (ReadPropertyByte(&exif,&length) != 0x78)
1363 if (ReadPropertyByte(&exif,&length) != 0x69)
1365 if (ReadPropertyByte(&exif,&length) != 0x66)
1367 if (ReadPropertyByte(&exif,&length) != 0x00)
1369 if (ReadPropertyByte(&exif,&length) != 0x00)
1374 return(MagickFalse);
1375 id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif);
1383 return(MagickFalse);
1384 if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a)
1385 return(MagickFalse);
1389 offset=(ssize_t) ReadPropertySignedLong(endian,exif+4);
1390 if ((offset < 0) || (size_t) offset >= length)
1391 return(MagickFalse);
1396 directory=exif+offset;
1400 exif_resources=NewSplayTree((
int (*)(
const void *,
const void *)) NULL,
1401 (
void *(*)(
void *)) NULL,(
void *(*)(
void *)) NULL);
1410 directory=directory_stack[level].directory;
1411 entry=directory_stack[level].entry;
1412 tag_offset=directory_stack[level].offset;
1414 if ((directory < exif) || (directory > (exif+length-2)))
1419 number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory);
1420 for ( ; entry < number_entries; entry++)
1433 q=(
unsigned char *) (directory+(12*entry)+2);
1434 if (q > (exif+length-12))
1436 if (GetValueFromSplayTree(exif_resources,q) == q)
1438 (void) AddValueToSplayTree(exif_resources,q,q);
1439 tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset;
1440 format=(size_t) ReadPropertyUnsignedShort(endian,q+2);
1441 if (format >= (
sizeof(tag_bytes)/
sizeof(*tag_bytes)))
1445 components=(ssize_t) ReadPropertySignedLong(endian,q+4);
1448 number_bytes=(size_t) components*tag_bytes[format];
1449 if (number_bytes < components)
1451 if (number_bytes <= 4)
1461 dir_offset=(ssize_t) ReadPropertySignedLong(endian,q+8);
1462 if ((dir_offset < 0) || (size_t) dir_offset >= length)
1464 if (((
size_t) dir_offset+number_bytes) < (
size_t) dir_offset)
1466 if (((
size_t) dir_offset+number_bytes) > length)
1468 p=(
unsigned char *) (exif+dir_offset);
1470 if ((all != 0) || (tag == (size_t) tag_value))
1473 buffer[MaxTextExtent],
1476 if ((p < exif) || (p > (exif+length-tag_bytes[format])))
1478 value=(
char *) NULL;
1484 value=(
char *) NULL;
1485 if (~((
size_t) number_bytes) >= 1)
1486 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1488 if (value != (
char *) NULL)
1490 for (i=0; i < (ssize_t) number_bytes; i++)
1493 if (isprint((
int) p[i]) != 0)
1494 value[i]=(char) p[i];
1500 case EXIF_FMT_SBYTE:
1502 EXIFMultipleValues(
"%.20g",(
double) (*(
signed char *) p));
1505 case EXIF_FMT_SSHORT:
1507 EXIFMultipleValues(
"%hd",ReadPropertySignedShort(endian,p));
1510 case EXIF_FMT_USHORT:
1512 EXIFMultipleValues(
"%hu",ReadPropertyUnsignedShort(endian,p));
1515 case EXIF_FMT_ULONG:
1517 EXIFMultipleValues(
"%.20g",(
double)
1518 ReadPropertyUnsignedLong(endian,p));
1521 case EXIF_FMT_SLONG:
1523 EXIFMultipleValues(
"%.20g",(
double)
1524 ReadPropertySignedLong(endian,p));
1527 case EXIF_FMT_URATIONAL:
1529 if ((tag_value == GPS_LATITUDE) || (tag_value == GPS_LONGITUDE) ||
1530 (tag_value == GPS_TIMESTAMP))
1533 EXIFGPSFractions(
"%.20g/%.20g,%.20g/%.20g,%.20g/%.20g",
1534 (
double) ReadPropertyUnsignedLong(endian,p),
1535 (
double) ReadPropertyUnsignedLong(endian,p+4),
1536 (
double) ReadPropertyUnsignedLong(endian,p+8),
1537 (
double) ReadPropertyUnsignedLong(endian,p+12),
1538 (
double) ReadPropertyUnsignedLong(endian,p+16),
1539 (
double) ReadPropertyUnsignedLong(endian,p+20));
1542 EXIFMultipleFractions(
"%.20g/%.20g",(
double)
1543 ReadPropertyUnsignedLong(endian,p),(
double)
1544 ReadPropertyUnsignedLong(endian,p+4));
1547 case EXIF_FMT_SRATIONAL:
1549 EXIFMultipleFractions(
"%.20g/%.20g",(
double)
1550 ReadPropertySignedLong(endian,p),(
double)
1551 ReadPropertySignedLong(endian,p+4));
1554 case EXIF_FMT_SINGLE:
1556 EXIFMultipleValues(
"%.20g",(
double)
1557 ReadPropertySignedLong(endian,p));
1560 case EXIF_FMT_DOUBLE:
1562 EXIFMultipleValues(
"%.20g",(
double)
1563 ReadPropertySignedLong(endian,p));
1566 case EXIF_FMT_STRING:
1567 case EXIF_FMT_UNDEFINED:
1570 if ((p < exif) || (p > (exif+length-number_bytes)))
1572 value=(
char *) NULL;
1573 if (~((
size_t) number_bytes) >= 1)
1574 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1576 if (value != (
char *) NULL)
1581 for (i=0; i < (ssize_t) number_bytes; i++)
1584 if ((isprint((
int) p[i]) != 0) || (p[i] ==
'\0'))
1585 value[i]=(char) p[i];
1592 if (value != (
char *) NULL)
1600 key=AcquireString(property);
1611 description=
"unknown";
1614 if (EXIFTag[i].tag == 0)
1616 if (EXIFTag[i].tag == tag_value)
1618 description=EXIFTag[i].description;
1622 (void) FormatLocaleString(key,MaxTextExtent,
"%s",
1625 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1630 if (tag_value < 0x10000)
1631 (void) FormatLocaleString(key,MaxTextExtent,
"#%04lx",
1632 (
unsigned long) tag_value);
1634 if (tag_value < 0x20000)
1635 (void) FormatLocaleString(key,MaxTextExtent,
"@%04lx",
1636 (
unsigned long) (tag_value & 0xffff));
1638 (
void) FormatLocaleString(key,MaxTextExtent,
"unknown");
1644 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1647 p=(
const char *) NULL;
1648 if (image->properties != (
void *) NULL)
1650 image->properties,key);
1651 if (p == (
const char *) NULL)
1652 (void) SetImageProperty((
Image *) image,key,value);
1653 value=DestroyString(value);
1654 key=DestroyString(key);
1658 if ((tag_value == TAG_EXIF_OFFSET) ||
1659 (tag_value == TAG_INTEROP_OFFSET) || (tag_value == TAG_GPS_OFFSET))
1664 offset=(ssize_t) ReadPropertySignedLong(endian,p);
1665 if (((
size_t) offset < length) && (level < (MaxDirectoryStack-2)))
1670 tag_offset1=(ssize_t) ((tag_value == TAG_GPS_OFFSET) ? 0x10000 :
1672 directory_stack[level].directory=directory;
1674 directory_stack[level].entry=entry;
1675 directory_stack[level].offset=tag_offset;
1680 for (i=0; i < level; i++)
1681 if (directory_stack[i].directory == (exif+tag_offset1))
1685 directory_stack[level].directory=exif+offset;
1686 directory_stack[level].offset=tag_offset1;
1687 directory_stack[level].entry=0;
1689 if ((directory+2+(12*number_entries)+4) > (exif+length))
1691 offset=(ssize_t) ReadPropertySignedLong(endian,directory+2+(12*
1693 if ((offset != 0) && ((size_t) offset < length) &&
1694 (level < (MaxDirectoryStack-2)))
1696 directory_stack[level].directory=exif+offset;
1697 directory_stack[level].entry=0;
1698 directory_stack[level].offset=tag_offset1;
1705 }
while (level > 0);
1706 exif_resources=DestroySplayTree(exif_resources);
1710 static MagickBooleanType GetICCProperty(
const Image *image)
1718 profile=GetImageProfile(image,
"icc");
1720 profile=GetImageProfile(image,
"icm");
1722 return(MagickFalse);
1723 if (GetStringInfoLength(profile) < 128)
1724 return(MagickFalse);
1725 #if defined(MAGICKCORE_LCMS_DELEGATE)
1730 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
1731 (cmsUInt32Number) GetStringInfoLength(profile));
1732 if (icc_profile != (cmsHPROFILE *) NULL)
1734 #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
1738 name=cmsTakeProductName(icc_profile);
1739 if (name != (
const char *) NULL)
1740 (void) SetImageProperty((
Image *) image,
"icc:name",name);
1748 info=AcquireStringInfo(0);
1749 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
"US",
1753 SetStringInfoLength(info,extent+1);
1754 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
1755 "US",(
char *) GetStringInfoDatum(info),extent);
1757 (void) SetImageProperty((
Image *) image,
"icc:description",
1758 (
char *) GetStringInfoDatum(info));
1760 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
"US",
1764 SetStringInfoLength(info,extent+1);
1765 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
1766 "US",(
char *) GetStringInfoDatum(info),extent);
1768 (void) SetImageProperty((
Image *) image,
"icc:manufacturer",
1769 (
char *) GetStringInfoDatum(info));
1771 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1775 SetStringInfoLength(info,extent+1);
1776 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1777 (
char *) GetStringInfoDatum(info),extent);
1779 (void) SetImageProperty((
Image *) image,
"icc:model",
1780 (
char *) GetStringInfoDatum(info));
1782 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
"US",
1786 SetStringInfoLength(info,extent+1);
1787 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
1788 "US",(
char *) GetStringInfoDatum(info),extent);
1790 (void) SetImageProperty((
Image *) image,
"icc:copyright",
1791 (
char *) GetStringInfoDatum(info));
1793 info=DestroyStringInfo(info);
1795 (void) cmsCloseProfile(icc_profile);
1802 static MagickBooleanType SkipXMPValue(
const char *value)
1804 if (value == (
const char*) NULL)
1806 while (*value !=
'\0')
1808 if (isspace((
int) ((
unsigned char) *value)) == 0)
1809 return(MagickFalse);
1815 static MagickBooleanType GetXMPProperty(
const Image *image,
const char *property)
1842 profile=GetImageProfile(image,
"xmp");
1844 return(MagickFalse);
1845 if (GetStringInfoLength(profile) < 17)
1846 return(MagickFalse);
1847 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1848 return(MagickFalse);
1849 xmp_profile=StringInfoToString(profile);
1850 if (xmp_profile == (
char *) NULL)
1851 return(MagickFalse);
1852 for (p=xmp_profile; *p !=
'\0'; p++)
1853 if ((*p ==
'<') && (*(p+1) ==
'x'))
1855 exception=AcquireExceptionInfo();
1856 xmp=NewXMLTree((
char *) p,exception);
1857 xmp_profile=DestroyString(xmp_profile);
1858 exception=DestroyExceptionInfo(exception);
1860 return(MagickFalse);
1862 rdf=GetXMLTreeChild(xmp,
"rdf:RDF");
1865 if (image->properties == (
void *) NULL)
1866 ((
Image *) image)->properties=NewSplayTree(CompareSplayTreeString,
1867 RelinquishMagickMemory,RelinquishMagickMemory);
1868 description=GetXMLTreeChild(rdf,
"rdf:Description");
1871 node=GetXMLTreeChild(description,(
const char *) NULL);
1877 child=GetXMLTreeChild(node,(
const char *) NULL);
1878 content=GetXMLTreeContent(node);
1880 (SkipXMPValue(content) == MagickFalse))
1882 xmp_namespace=ConstantString(GetXMLTreeTag(node));
1883 (void) SubstituteString(&xmp_namespace,
"exif:",
"xmp:");
1884 (void) AddValueToSplayTree((
SplayTreeInfo *) image->properties,
1885 xmp_namespace,ConstantString(content));
1889 content=GetXMLTreeContent(child);
1890 if (SkipXMPValue(content) == MagickFalse)
1892 xmp_namespace=ConstantString(GetXMLTreeTag(node));
1893 (void) SubstituteString(&xmp_namespace,
"exif:",
"xmp:");
1894 (void) AddValueToSplayTree((
SplayTreeInfo *) image->properties,
1895 xmp_namespace,ConstantString(content));
1897 child=GetXMLTreeSibling(child);
1899 node=GetXMLTreeSibling(node);
1901 description=GetNextXMLTreeTag(description);
1904 xmp=DestroyXMLTree(xmp);
1908 static char *TracePSClippath(
const unsigned char *blob,
size_t length,
1909 const size_t magick_unused(columns),
const size_t magick_unused(rows))
1932 magick_unreferenced(columns);
1933 magick_unreferenced(rows);
1935 path=AcquireString((
char *) NULL);
1936 if (path == (
char *) NULL)
1937 return((
char *) NULL);
1938 message=AcquireString((
char *) NULL);
1939 (void) FormatLocaleString(message,MaxTextExtent,
"/ClipImage\n");
1940 (void) ConcatenateString(&path,message);
1941 (void) FormatLocaleString(message,MaxTextExtent,
"{\n");
1942 (void) ConcatenateString(&path,message);
1943 (void) FormatLocaleString(message,MaxTextExtent,
" /c {curveto} bind def\n");
1944 (void) ConcatenateString(&path,message);
1945 (void) FormatLocaleString(message,MaxTextExtent,
" /l {lineto} bind def\n");
1946 (void) ConcatenateString(&path,message);
1947 (void) FormatLocaleString(message,MaxTextExtent,
" /m {moveto} bind def\n");
1948 (void) ConcatenateString(&path,message);
1949 (void) FormatLocaleString(message,MaxTextExtent,
1950 " /v {currentpoint 6 2 roll curveto} bind def\n");
1951 (void) ConcatenateString(&path,message);
1952 (void) FormatLocaleString(message,MaxTextExtent,
1953 " /y {2 copy curveto} bind def\n");
1954 (void) ConcatenateString(&path,message);
1955 (void) FormatLocaleString(message,MaxTextExtent,
1956 " /z {closepath} bind def\n");
1957 (void) ConcatenateString(&path,message);
1958 (void) FormatLocaleString(message,MaxTextExtent,
" newpath\n");
1959 (void) ConcatenateString(&path,message);
1964 (void) memset(point,0,
sizeof(point));
1965 (void) memset(first,0,
sizeof(first));
1966 (void) memset(last,0,
sizeof(last));
1968 in_subpath=MagickFalse;
1971 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
1977 if (knot_count != 0)
1980 length-=MagickMin(24,(ssize_t) length);
1986 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
1988 length-=MagickMin(22,(ssize_t) length);
1996 if (knot_count == 0)
2002 length-=MagickMin(24,(ssize_t) length);
2008 for (i=0; i < 3; i++)
2010 y=(size_t) ReadPropertyMSBLong(&blob,&length);
2011 x=(size_t) ReadPropertyMSBLong(&blob,&length);
2012 point[i].x=(double) x/4096.0/4096.0;
2013 point[i].y=1.0-(double) y/4096.0/4096.0;
2015 if (in_subpath == MagickFalse)
2017 (void) FormatLocaleString(message,MaxTextExtent,
" %g %g m\n",
2018 point[1].x,point[1].y);
2019 for (i=0; i < 3; i++)
2031 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2032 (point[0].x == point[1].x) && (point[0].y == point[1].y))
2033 (void) FormatLocaleString(message,MaxTextExtent,
2034 " %g %g l\n",point[1].x,point[1].y);
2036 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2037 (void) FormatLocaleString(message,MaxTextExtent,
2038 " %g %g %g %g v\n",point[0].x,point[0].y,
2039 point[1].x,point[1].y);
2041 if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
2042 (void) FormatLocaleString(message,MaxTextExtent,
2043 " %g %g %g %g y\n",last[2].x,last[2].y,
2044 point[1].x,point[1].y);
2046 (
void) FormatLocaleString(message,MaxTextExtent,
2047 " %g %g %g %g %g %g c\n",last[2].x,
2048 last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
2049 for (i=0; i < 3; i++)
2052 (void) ConcatenateString(&path,message);
2053 in_subpath=MagickTrue;
2058 if (knot_count == 0)
2064 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2065 (first[0].x == first[1].x) && (first[0].y == first[1].y))
2066 (void) FormatLocaleString(message,MaxTextExtent,
2067 " %g %g l z\n",first[1].x,first[1].y);
2069 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2070 (void) FormatLocaleString(message,MaxTextExtent,
2071 " %g %g %g %g v z\n",first[0].x,first[0].y,
2072 first[1].x,first[1].y);
2074 if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
2075 (void) FormatLocaleString(message,MaxTextExtent,
2076 " %g %g %g %g y z\n",last[2].x,last[2].y,
2077 first[1].x,first[1].y);
2079 (
void) FormatLocaleString(message,MaxTextExtent,
2080 " %g %g %g %g %g %g c z\n",last[2].x,
2081 last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
2082 (void) ConcatenateString(&path,message);
2083 in_subpath=MagickFalse;
2093 length-=MagickMin(24,(ssize_t) length);
2101 (void) FormatLocaleString(message,MaxTextExtent,
" eoclip\n");
2102 (void) ConcatenateString(&path,message);
2103 (void) FormatLocaleString(message,MaxTextExtent,
"} bind def");
2104 (void) ConcatenateString(&path,message);
2105 message=DestroyString(message);
2109 static inline void TraceBezierCurve(
char *message,
PointInfo *last,
2116 if (((last+1)->x == (last+2)->x) && ((last+1)->y == (last+2)->y) &&
2117 (point->x == (point+1)->x) && (point->y == (point+1)->y))
2118 (void) FormatLocaleString(message,MagickPathExtent,
2119 "L %g %g\n",point[1].x,point[1].y);
2121 (
void) FormatLocaleString(message,MagickPathExtent,
"C %g %g %g %g %g %g\n",
2122 (last+2)->x,(last+2)->y,point->x,point->y,(point+1)->x,(point+1)->y);
2125 static char *TraceSVGClippath(
const unsigned char *blob,
size_t length,
2126 const size_t columns,
const size_t rows)
2149 path=AcquireString((
char *) NULL);
2150 if (path == (
char *) NULL)
2151 return((
char *) NULL);
2152 message=AcquireString((
char *) NULL);
2153 (void) FormatLocaleString(message,MaxTextExtent,(
2154 "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
2155 "<svg xmlns=\"http://www.w3.org/2000/svg\""
2156 " width=\"%.20g\" height=\"%.20g\">\n"
2158 "<path fill-rule=\"evenodd\" style=\"fill:#000000;stroke:#000000;"
2159 "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),(double) columns,
2161 (void) ConcatenateString(&path,message);
2162 (void) memset(point,0,
sizeof(point));
2163 (void) memset(first,0,
sizeof(first));
2164 (void) memset(last,0,
sizeof(last));
2166 in_subpath=MagickFalse;
2169 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2175 if (knot_count != 0)
2178 length-=MagickMin(24,(ssize_t) length);
2184 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2186 length-=MagickMin(22,(ssize_t) length);
2194 if (knot_count == 0)
2200 length-=MagickMin(24,(ssize_t) length);
2206 for (i=0; i < 3; i++)
2208 y=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2209 x=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2210 point[i].x=(double) x*columns/4096.0/4096.0;
2211 point[i].y=(double) y*rows/4096.0/4096.0;
2213 if (in_subpath == MagickFalse)
2215 (void) FormatLocaleString(message,MaxTextExtent,
"M %g %g\n",
2216 point[1].x,point[1].y);
2217 for (i=0; i < 3; i++)
2225 TraceBezierCurve(message,last,point);
2226 for (i=0; i < 3; i++)
2229 (void) ConcatenateString(&path,message);
2230 in_subpath=MagickTrue;
2235 if (knot_count == 0)
2237 TraceBezierCurve(message,last,first);
2238 (void) ConcatenateString(&path,message);
2239 in_subpath=MagickFalse;
2249 length-=MagickMin(24,(ssize_t) length);
2257 (void) ConcatenateString(&path,
"\"/>\n</g>\n</svg>\n");
2258 message=DestroyString(message);
2262 MagickExport
const char *GetImageProperty(
const Image *image,
2263 const char *property)
2280 assert(image != (
Image *) NULL);
2281 assert(image->signature == MagickCoreSignature);
2282 if (IsEventLogging() != MagickFalse)
2283 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2284 p=(
const char *) NULL;
2285 if (image->properties != (
void *) NULL)
2287 if (property == (
const char *) NULL)
2289 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
2294 if (LocaleNCompare(
"fx:",property,3) != 0)
2297 image->properties,property);
2298 if (p != (
const char *) NULL)
2302 if ((property == (
const char *) NULL) ||
2303 (strchr(property,
':') == (
char *) NULL))
2305 exception=(&((
Image *) image)->exception);
2310 if (LocaleNCompare(
"8bim:",property,5) == 0)
2312 (void) Get8BIMProperty(image,property);
2320 if (LocaleNCompare(
"exif:",property,5) == 0)
2322 (void) GetEXIFProperty(image,property);
2330 if (LocaleNCompare(
"fx:",property,3) == 0)
2332 if ((image->columns == 0) || (image->rows == 0))
2334 fx_info=AcquireFxInfo(image,property+3);
2335 status=FxEvaluateChannelExpression(fx_info,DefaultChannels,0,0,&alpha,
2337 fx_info=DestroyFxInfo(fx_info);
2338 if (status != MagickFalse)
2341 value[MaxTextExtent];
2343 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
2344 GetMagickPrecision(),(double) alpha);
2345 (void) SetImageProperty((
Image *) image,property,value);
2354 if (LocaleNCompare(
"hex:",property,4) == 0)
2359 if ((image->columns == 0) || (image->rows == 0))
2361 GetMagickPixelPacket(image,&pixel);
2362 fx_info=AcquireFxInfo(image,property+4);
2363 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2365 pixel.red=(MagickRealType) QuantumRange*alpha;
2366 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2368 pixel.green=(MagickRealType) QuantumRange*alpha;
2369 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2371 pixel.blue=(MagickRealType) QuantumRange*alpha;
2372 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2374 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2375 if (image->colorspace == CMYKColorspace)
2377 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2379 pixel.index=(MagickRealType) QuantumRange*alpha;
2381 fx_info=DestroyFxInfo(fx_info);
2382 if (status != MagickFalse)
2387 GetColorTuple(&pixel,MagickTrue,hex);
2388 (void) SetImageProperty((
Image *) image,property,hex+1);
2397 if ((LocaleNCompare(
"icc:",property,4) == 0) ||
2398 (LocaleNCompare(
"icm:",property,4) == 0))
2400 (void) GetICCProperty(image);
2403 if (LocaleNCompare(
"iptc:",property,5) == 0)
2405 (void) GetIPTCProperty(image,property);
2413 if (LocaleNCompare(
"pixel:",property,6) == 0)
2418 GetMagickPixelPacket(image,&pixel);
2419 fx_info=AcquireFxInfo(image,property+6);
2420 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2422 pixel.red=(MagickRealType) QuantumRange*alpha;
2423 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2425 pixel.green=(MagickRealType) QuantumRange*alpha;
2426 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2428 pixel.blue=(MagickRealType) QuantumRange*alpha;
2429 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2431 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2432 if (image->colorspace == CMYKColorspace)
2434 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2436 pixel.index=(MagickRealType) QuantumRange*alpha;
2438 fx_info=DestroyFxInfo(fx_info);
2439 if (status != MagickFalse)
2442 name[MaxTextExtent];
2447 GetColorTuple(&pixel,MagickFalse,name);
2448 value=GetImageArtifact(image,
"pixel:compliance");
2449 if (value != (
char *) NULL)
2451 ComplianceType compliance=(ComplianceType) ParseCommandOption(
2452 MagickComplianceOptions,MagickFalse,value);
2453 (void) QueryMagickColorname(image,&pixel,compliance,name,
2456 (void) SetImageProperty((
Image *) image,property,name);
2465 if (LocaleNCompare(
"xmp:",property,4) == 0)
2467 (void) GetXMPProperty(image,property);
2475 if (image->properties != (
void *) NULL)
2478 image->properties,property);
2481 return((
const char *) NULL);
2570 static const char *GetMagickPropertyLetter(
const ImageInfo *image_info,
2571 Image *image,
const char letter)
2573 #define WarnNoImageInfoReturn(format,arg) \
2574 if (image_info == (ImageInfo *) NULL ) { \
2575 (void) ThrowMagickException(&image->exception,GetMagickModule(), \
2576 OptionWarning,"NoImageInfoForProperty",format,arg); \
2577 return((const char *) NULL); \
2581 value[MaxTextExtent];
2586 assert(image != (
Image *) NULL);
2587 assert(image->signature == MagickCoreSignature);
2588 if (IsEventLogging() != MagickFalse)
2589 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2591 string=(
char *) NULL;
2599 (void) FormatMagickSize(image->extent,MagickFalse,value);
2600 if (image->extent == 0)
2601 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
2609 string=GetImageProperty(image,
"comment");
2610 if (
string == (
const char *) NULL)
2619 GetPathComponent(image->magick_filename,HeadPath,value);
2629 GetPathComponent(image->magick_filename,ExtensionPath,value);
2639 GetPathComponent(image->magick_filename,TailPath,value);
2649 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
2650 (
double) image->page.width,(double) image->page.height,
2651 (
double) image->page.x,(double) image->page.y);
2659 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2660 (image->rows != 0 ? image->rows : image->magick_rows));
2668 string=image->filename;
2676 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2677 GetNumberColors(image,(FILE *) NULL,&image->exception));
2685 string=GetImageProperty(image,
"label");
2686 if (
string == (
const char *) NULL)
2695 string=image->magick;
2703 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2704 GetImageListLength(image));
2712 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2713 string=image_info->filename;
2721 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2722 GetImageIndexInList(image));
2730 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2731 MAGICKCORE_QUANTUM_DEPTH);
2742 colorspace=image->colorspace;
2743 if ((image->columns != 0) && (image->rows != 0) &&
2744 (SetImageGray(image,&image->exception) != MagickFalse))
2745 colorspace=GRAYColorspace;
2746 (void) FormatLocaleString(value,MaxTextExtent,
"%s %s %s",
2747 CommandOptionToMnemonic(MagickClassOptions,(ssize_t)
2748 image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions,
2749 (ssize_t) colorspace),image->matte != MagickFalse ?
"Matte" :
"" );
2757 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2758 if (image_info->number_scenes != 0)
2759 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2762 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2771 GetPathComponent(image->magick_filename,BasePath,value);
2781 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2782 string=image_info->unique;
2790 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2791 (image->columns != 0 ? image->columns : image->magick_columns));
2799 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2800 fabs(image->x_resolution) > MagickEpsilon ? image->x_resolution :
2801 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2810 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2811 fabs(image->y_resolution) > MagickEpsilon ? image->y_resolution :
2812 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2821 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2830 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2831 CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte));
2839 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2841 if (image->extent == 0)
2842 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2843 GetBlobSize(image));
2851 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2852 CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
2853 image->compression));
2861 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2862 CommandOptionToMnemonic(MagickDisposeOptions,(ssize_t) image->dispose));
2875 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "
2876 "$-_.+!*'(),{}|\\^~[]`\"><#%;/?:@&=";
2881 (void) CopyMagickString(value,image->magick_filename,MaxTextExtent);
2883 q=value+strlen(value);
2884 for (p+=strspn(p,allowlist); p != q; p+=strspn(p,allowlist))
2893 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2894 image->magick_columns,(double) image->magick_rows);
2902 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2903 image->page.height);
2911 string=image->magick_filename;
2916 if ((image != (
Image *) NULL) && (image->next == (
Image *) NULL))
2917 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g\n",(
double)
2918 GetImageListLength(image));
2928 (void) FormatLocaleString(value,MaxTextExtent,
"%+ld%+ld",(
long)
2929 image->page.x,(long) image->page.y);
2937 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2938 image->page.width,(double) image->page.height);
2946 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2947 (image->quality == 0 ? 92 : image->quality));
2955 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2956 if (image_info->number_scenes == 0)
2957 string=
"2147483647";
2959 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2960 image_info->scene+image_info->number_scenes);
2968 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2977 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2978 CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
2987 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2996 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
3005 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
3014 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
3015 string=image_info->zero;
3026 page=GetImageBoundingBox(image,&image->exception);
3027 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
3028 (
double) page.width,(double) page.height,(
double) page.x,(double)
3037 if ((image->columns != 0) && (image->rows != 0))
3038 (void) SignatureImage(image);
3039 string=GetImageProperty(image,
"signature");
3053 if (
string != (
char *) NULL)
3055 (void) SetImageArtifact(image,
"get-property",
string);
3056 return(GetImageArtifact(image,
"get-property"));
3058 return((
char *) NULL);
3061 MagickExport
const char *GetMagickProperty(
const ImageInfo *image_info,
3062 Image *image,
const char *property)
3065 value[MaxTextExtent];
3070 assert(property != (
const char *) NULL);
3071 assert(property[0] !=
'\0');
3072 if (property[1] ==
'\0')
3073 return(GetMagickPropertyLetter(image_info,image,*property));
3075 string=(
char *) NULL;
3080 if ((LocaleCompare(
"base",property) == 0) ||
3081 (LocaleCompare(
"basename",property) == 0) )
3083 GetPathComponent(image->magick_filename,BasePath,value);
3086 if (LocaleCompare(
"bit-depth",property) == 0)
3088 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3089 GetImageDepth(image,&image->exception));
3092 if (LocaleCompare(
"bounding-box",property) == 0)
3097 geometry=GetImageBoundingBox(image,&image->exception);
3098 (void) FormatLocaleString(value,MagickPathExtent,
"%g,%g %g,%g\n",
3099 (
double) geometry.x,(double) geometry.y,
3100 (
double) geometry.x+geometry.width,
3101 (double) geometry.y+geometry.height);
3108 if (LocaleCompare(
"channels",property) == 0)
3113 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
3114 CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3115 image->colorspace));
3117 if (image->matte != MagickFalse)
3118 (void) ConcatenateMagickString(value,
"a",MaxTextExtent);
3121 if (LocaleCompare(
"colors",property) == 0)
3123 image->colors=GetNumberColors(image,(FILE *) NULL,&image->exception);
3124 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3128 if (LocaleCompare(
"colorspace",property) == 0)
3130 string=CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3134 if (LocaleCompare(
"compose",property) == 0)
3136 string=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t)
3140 if (LocaleCompare(
"compression",property) == 0)
3142 string=CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
3143 image->compression);
3146 if (LocaleCompare(
"copyright",property) == 0)
3148 (void) CopyMagickString(value,GetMagickCopyright(),MaxTextExtent);
3155 if (LocaleCompare(
"depth",property) == 0)
3157 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3161 if (LocaleCompare(
"directory",property) == 0)
3163 GetPathComponent(image->magick_filename,HeadPath,value);
3170 if (LocaleCompare(
"entropy",property) == 0)
3175 (void) GetImageChannelEntropy(image,image_info->channel,&entropy,
3177 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3178 GetMagickPrecision(),entropy);
3181 if (LocaleCompare(
"extension",property) == 0)
3183 GetPathComponent(image->magick_filename,ExtensionPath,value);
3190 if (LocaleCompare(
"gamma",property) == 0)
3192 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3193 GetMagickPrecision(),image->gamma);
3196 if ((image_info != (
ImageInfo *) NULL) &&
3197 (LocaleCompare(
"group",property) == 0))
3199 (void) FormatLocaleString(value,MaxTextExtent,
"0x%lx",(
unsigned long)
3207 if (LocaleCompare(
"height",property) == 0)
3209 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3210 image->magick_rows != 0 ? (
double) image->magick_rows : 256.0);
3217 if (LocaleCompare(
"input",property) == 0)
3219 string=image->filename;
3222 if (LocaleCompare(
"interlace",property) == 0)
3224 string=CommandOptionToMnemonic(MagickInterlaceOptions,(ssize_t)
3232 if (LocaleCompare(
"kurtosis",property) == 0)
3238 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3239 &skewness,&image->exception);
3240 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3241 GetMagickPrecision(),kurtosis);
3248 if (LocaleCompare(
"magick",property) == 0)
3250 string=image->magick;
3253 if ((LocaleCompare(
"max",property) == 0) ||
3254 (LocaleCompare(
"maxima",property) == 0))
3260 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3261 &maximum,&image->exception);
3262 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3263 GetMagickPrecision(),maximum);
3266 if (LocaleCompare(
"mean",property) == 0)
3272 (void) GetImageChannelMean(image,image_info->channel,&mean,
3273 &standard_deviation,&image->exception);
3274 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3275 GetMagickPrecision(),mean);
3278 if ((LocaleCompare(
"min",property) == 0) ||
3279 (LocaleCompare(
"minima",property) == 0))
3285 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3286 &maximum,&image->exception);
3287 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3288 GetMagickPrecision(),minimum);
3295 if (LocaleCompare(
"opaque",property) == 0)
3300 opaque=IsOpaqueImage(image,&image->exception);
3301 (void) CopyMagickString(value,opaque != MagickFalse ?
"true" :
3302 "false",MaxTextExtent);
3305 if (LocaleCompare(
"orientation",property) == 0)
3307 string=CommandOptionToMnemonic(MagickOrientationOptions,(ssize_t)
3308 image->orientation);
3311 if ((image_info != (
ImageInfo *) NULL) &&
3312 (LocaleCompare(
"output",property) == 0))
3314 (void) CopyMagickString(value,image_info->filename,MaxTextExtent);
3321 if (LocaleCompare(
"page",property) == 0)
3323 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
3324 image->page.width,(double) image->page.height);
3327 if (LocaleNCompare(
"papersize:",property,10) == 0)
3333 papersize=GetPageGeometry(property+10);
3334 if (papersize != (
const char *) NULL)
3337 page = { 0, 0, 0, 0 };
3339 (void) ParseAbsoluteGeometry(papersize,&page);
3340 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",
3341 (
double) page.width,(double) page.height);
3342 papersize=DestroyString(papersize);
3346 #if defined(MAGICKCORE_LCMS_DELEGATE)
3347 if (LocaleCompare(
"profile:icc",property) == 0 ||
3348 LocaleCompare(
"profile:icm",property) == 0)
3350 #if !defined(LCMS_VERSION) || (LCMS_VERSION < 2000)
3351 #define cmsUInt32Number DWORD
3360 profile=GetImageProfile(image,property+8);
3364 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
3365 (cmsUInt32Number) GetStringInfoLength(profile));
3366 if (icc_profile != (cmsHPROFILE *) NULL)
3368 #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
3369 string=cmsTakeProductName(icc_profile);
3371 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
3372 "en",
"US",value,MaxTextExtent);
3374 (void) cmsCloseProfile(icc_profile);
3378 if (LocaleCompare(
"printsize.x",property) == 0)
3380 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3381 GetMagickPrecision(),PerceptibleReciprocal(image->x_resolution)*
3385 if (LocaleCompare(
"printsize.y",property) == 0)
3387 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3388 GetMagickPrecision(),PerceptibleReciprocal(image->y_resolution)*
3392 if (LocaleCompare(
"profiles",property) == 0)
3397 ResetImageProfileIterator(image);
3398 name=GetNextImageProfile(image);
3399 if (name != (
char *) NULL)
3401 (void) CopyMagickString(value,name,MaxTextExtent);
3402 name=GetNextImageProfile(image);
3403 while (name != (
char *) NULL)
3405 ConcatenateMagickString(value,
",",MaxTextExtent);
3406 ConcatenateMagickString(value,name,MaxTextExtent);
3407 name=GetNextImageProfile(image);
3416 if (LocaleCompare(
"quality",property) == 0)
3418 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3426 if (LocaleCompare(
"rendering-intent",property) == 0)
3428 string=CommandOptionToMnemonic(MagickIntentOptions,(ssize_t)
3429 image->rendering_intent);
3432 if (LocaleCompare(
"resolution.x",property) == 0)
3434 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3435 image->x_resolution);
3438 if (LocaleCompare(
"resolution.y",property) == 0)
3440 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3441 image->y_resolution);
3448 if (LocaleCompare(
"scene",property) == 0)
3450 if ((image_info != (
ImageInfo *) NULL) &&
3451 (image_info->number_scenes != 0))
3452 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3455 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3459 if (LocaleCompare(
"scenes",property) == 0)
3461 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3462 GetImageListLength(image));
3465 if (LocaleCompare(
"size",property) == 0)
3467 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
3470 if (LocaleCompare(
"skewness",property) == 0)
3476 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3477 &skewness,&image->exception);
3478 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3479 GetMagickPrecision(),skewness);
3482 if ((LocaleCompare(
"standard-deviation",property) == 0) ||
3483 (LocaleCompare(
"standard_deviation",property) == 0))
3489 (void) GetImageChannelMean(image,image_info->channel,&mean,
3490 &standard_deviation,&image->exception);
3491 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3492 GetMagickPrecision(),standard_deviation);
3499 if (LocaleCompare(
"type",property) == 0)
3501 string=CommandOptionToMnemonic(MagickTypeOptions,(ssize_t)
3502 IdentifyImageType(image,&image->exception));
3509 if ((image_info != (
ImageInfo *) NULL) &&
3510 (LocaleCompare(
"unique",property) == 0))
3512 string=image_info->unique;
3515 if (LocaleCompare(
"units",property) == 0)
3520 string=CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
3528 if (LocaleCompare(
"version",property) == 0)
3530 string=GetMagickVersion((
size_t *) NULL);
3537 if (LocaleCompare(
"width",property) == 0)
3539 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3540 (image->magick_columns != 0 ? image->magick_columns : 256));
3547 if ((LocaleCompare(
"xresolution",property) == 0) ||
3548 (LocaleCompare(
"x-resolution",property) == 0) )
3550 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3551 image->x_resolution);
3558 if ((LocaleCompare(
"yresolution",property) == 0) ||
3559 (LocaleCompare(
"y-resolution",property) == 0) )
3561 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3562 image->y_resolution);
3569 if ((image_info != (
ImageInfo *) NULL) &&
3570 (LocaleCompare(
"zero",property) == 0))
3572 string=image_info->zero;
3580 if (
string != (
char *) NULL)
3582 (void) SetImageArtifact(image,
"get-property",
string);
3583 return(GetImageArtifact(image,
"get-property"));
3585 return((
char *) NULL);
3610 MagickExport
char *GetNextImageProperty(
const Image *image)
3612 assert(image != (
Image *) NULL);
3613 assert(image->signature == MagickCoreSignature);
3614 if (IsEventLogging() != MagickFalse)
3615 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
3617 if (image->properties == (
void *) NULL)
3618 return((
char *) NULL);
3619 return((
char *) GetNextKeyInSplayTree((
SplayTreeInfo *) image->properties));
3674 MagickExport
char *InterpretImageProperties(
const ImageInfo *image_info,
3675 Image *image,
const char *embed_text)
3677 #define ExtendInterpretText(string_length) \
3679 size_t length=(string_length); \
3680 if ((size_t) (q-interpret_text+length+1) >= extent) \
3683 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3684 MaxTextExtent,sizeof(*interpret_text)); \
3685 if (interpret_text == (char *) NULL) \
3687 if (property_info != image_info) \
3688 property_info=DestroyImageInfo(property_info); \
3689 return((char *) NULL); \
3691 q=interpret_text+strlen(interpret_text); \
3695 #define AppendKeyValue2Text(key,value)\
3697 size_t length=strlen(key)+strlen(value)+2; \
3698 if ((size_t) (q-interpret_text+length+1) >= extent) \
3701 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3702 MaxTextExtent,sizeof(*interpret_text)); \
3703 if (interpret_text == (char *) NULL) \
3705 if (property_info != image_info) \
3706 property_info=DestroyImageInfo(property_info); \
3707 return((char *) NULL); \
3709 q=interpret_text+strlen(interpret_text); \
3711 q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(value)); \
3714 #define AppendString2Text(string) \
3716 size_t length=strlen((string)); \
3717 if ((size_t) (q-interpret_text+length+1) >= extent) \
3720 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3721 MaxTextExtent,sizeof(*interpret_text)); \
3722 if (interpret_text == (char *) NULL) \
3724 if (property_info != image_info) \
3725 property_info=DestroyImageInfo(property_info); \
3726 return((char *) NULL); \
3728 q=interpret_text+strlen(interpret_text); \
3730 (void) CopyMagickString(q,(string),extent); \
3752 assert(image != (
Image *) NULL);
3753 assert(image->signature == MagickCoreSignature);
3754 if (IsEventLogging() != MagickFalse)
3755 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
3756 if (embed_text == (
const char *) NULL)
3757 return(ConstantString(
""));
3759 while ((isspace((
int) ((
unsigned char) *p)) != 0) && (*p !=
'\0'))
3762 return(ConstantString(
""));
3763 if ((*p ==
'@') && (IsPathAccessible(p+1) != MagickFalse))
3768 if (IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,p) == MagickFalse)
3771 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3772 PolicyError,
"NotAuthorized",
"`%s'",p);
3773 return(ConstantString(
""));
3775 interpret_text=FileToString(p,~0UL,&image->exception);
3776 if (interpret_text != (
char *) NULL)
3777 return(interpret_text);
3785 property_info=CloneImageInfo(image_info);
3786 interpret_text=AcquireString(embed_text);
3787 extent=MaxTextExtent;
3789 for (q=interpret_text; *p!=
'\0';
3790 number=(isdigit((
int) ((
unsigned char) *p))) ? MagickTrue : MagickFalse,p++)
3796 ExtendInterpretText(MaxTextExtent);
3839 if (LocaleNCompare(
"<",p,4) == 0)
3845 if (LocaleNCompare(
">",p,4) == 0)
3851 if (LocaleNCompare(
"&",p,5) == 0)
3872 if ((*p ==
'\0') || (*p ==
'\'') || (*p ==
'"'))
3888 if (number != MagickFalse)
3894 value=GetMagickPropertyLetter(property_info,image,*p);
3895 if (value != (
char *) NULL)
3897 AppendString2Text(value);
3900 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3901 OptionWarning,
"UnknownImageProperty",
"\"%%%c\"",*p);
3906 pattern[2*MaxTextExtent] =
"\0";
3925 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3926 OptionWarning,
"UnknownImageProperty",
"\"%%[]\"");
3929 for (len=0; len<(MaxTextExtent-1L) && (*p !=
'\0');)
3931 if ((*p ==
'\\') && (*(p+1) !=
'\0'))
3936 pattern[len++]=(*p++);
3937 pattern[len++]=(*p++);
3946 pattern[len++]=(*p++);
3961 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3962 OptionError,
"UnbalancedBraces",
"\"%%[%s\"",pattern);
3963 interpret_text=DestroyString(interpret_text);
3964 if (property_info != image_info)
3965 property_info=DestroyImageInfo(property_info);
3966 return((
char *) NULL);
3971 if (LocaleNCompare(
"fx:",pattern,3) == 0)
3985 fx_info=AcquireFxInfo(image,pattern+3);
3986 status=FxEvaluateChannelExpression(fx_info,property_info->channel,0,0,
3987 &value,&image->exception);
3988 fx_info=DestroyFxInfo(fx_info);
3989 if (status != MagickFalse)
3992 result[MagickPathExtent];
3994 (void) FormatLocaleString(result,MagickPathExtent,
"%.*g",
3995 GetMagickPrecision(),(double) value);
3996 AppendString2Text(result);
4000 if (LocaleNCompare(
"option:",pattern,7) == 0)
4005 if (IsGlob(pattern+7) != MagickFalse)
4007 ResetImageOptionIterator(property_info);
4008 while ((key=GetNextImageOption(property_info)) != (
const char *) NULL)
4009 if (GlobExpression(key,pattern+7,MagickTrue) != MagickFalse)
4011 value=GetImageOption(property_info,key);
4012 if (value != (
const char *) NULL)
4013 AppendKeyValue2Text(key,value);
4018 value=GetImageOption(property_info,pattern+7);
4019 if (value != (
char *) NULL)
4020 AppendString2Text(value);
4024 if (LocaleNCompare(
"artifact:",pattern,9) == 0)
4029 if (IsGlob(pattern+9) != MagickFalse)
4031 ResetImageArtifactIterator(image);
4032 while ((key=GetNextImageArtifact(image)) != (
const char *) NULL)
4033 if (GlobExpression(key,pattern+9,MagickTrue) != MagickFalse)
4035 value=GetImageArtifact(image,key);
4036 if (value != (
const char *) NULL)
4037 AppendKeyValue2Text(key,value);
4042 value=GetImageArtifact(image,pattern+9);
4043 if (value != (
char *) NULL)
4044 AppendString2Text(value);
4054 value=GetImageProperty(image,pattern);
4055 if (value != (
const char *) NULL)
4057 AppendString2Text(value);
4064 if (IsGlob(pattern) != MagickFalse)
4066 ResetImagePropertyIterator(image);
4067 while ((key=GetNextImageProperty(image)) != (
const char *) NULL)
4068 if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
4070 value=GetImageProperty(image,key);
4071 if (value != (
const char *) NULL)
4072 AppendKeyValue2Text(key,value);
4082 value=GetMagickProperty(property_info,image,pattern);
4083 if (value != (
const char *) NULL)
4085 AppendString2Text(value);
4091 value=GetImageArtifact(image,pattern);
4092 if (value != (
char *) NULL)
4094 AppendString2Text(value);
4100 value=GetImageOption(property_info,pattern);
4101 if (value != (
char *) NULL)
4103 AppendString2Text(value);
4116 (void) ThrowMagickException(&image->exception,GetMagickModule(),
4117 OptionWarning,
"UnknownImageProperty",
"\"%%[%s]\"",pattern);
4122 if (property_info != image_info)
4123 property_info=DestroyImageInfo(property_info);
4124 return(interpret_text);
4155 MagickExport
char *RemoveImageProperty(
Image *image,
const char *property)
4160 assert(image != (
Image *) NULL);
4161 assert(image->signature == MagickCoreSignature);
4162 if (IsEventLogging() != MagickFalse)
4163 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4165 if (image->properties == (
void *) NULL)
4166 return((
char *) NULL);
4167 value=(
char *) RemoveNodeFromSplayTree((
SplayTreeInfo *) image->properties,
4196 MagickExport
void ResetImagePropertyIterator(
const Image *image)
4198 assert(image != (
Image *) NULL);
4199 assert(image->signature == MagickCoreSignature);
4200 if (IsEventLogging() != MagickFalse)
4201 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4203 if (image->properties == (
void *) NULL)
4205 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
4236 MagickExport MagickBooleanType SetImageProperty(
Image *image,
4237 const char *property,
const char *value)
4252 assert(image != (
Image *) NULL);
4253 assert(image->signature == MagickCoreSignature);
4254 if (IsEventLogging() != MagickFalse)
4255 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4257 if (image->properties == (
void *) NULL)
4258 image->properties=NewSplayTree(CompareSplayTreeString,
4259 RelinquishMagickMemory,RelinquishMagickMemory);
4260 if (value == (
const char *) NULL)
4261 return(DeleteImageProperty(image,property));
4262 exception=(&image->exception);
4263 property_length=strlen(property);
4264 if ((property_length > 2) && (*(property+(property_length-2)) ==
':') &&
4265 (*(property+(property_length-1)) ==
'*'))
4267 (void) ThrowMagickException(exception,GetMagickModule(),
4268 OptionWarning,
"SetReadOnlyProperty",
"`%s'",property);
4269 return(MagickFalse);
4284 if (LocaleCompare(
"background",property) == 0)
4286 (void) QueryColorDatabase(value,&image->background_color,exception);
4289 if (LocaleCompare(
"bias",property) == 0)
4291 image->bias=StringToDoubleInterval(value,(
double) QuantumRange+1.0);
4294 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4295 ConstantString(property),ConstantString(value));
4301 if (LocaleCompare(
"colorspace",property) == 0)
4306 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
4310 status=SetImageColorspace(image,(ColorspaceType) colorspace);
4313 if (LocaleCompare(
"compose",property) == 0)
4318 compose=ParseCommandOption(MagickComposeOptions,MagickFalse,value);
4321 image->compose=(CompositeOperator) compose;
4324 if (LocaleCompare(
"compress",property) == 0)
4329 compression=ParseCommandOption(MagickCompressOptions,MagickFalse,
4331 if (compression < 0)
4333 image->compression=(CompressionType) compression;
4336 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4337 ConstantString(property),ConstantString(value));
4343 if (LocaleCompare(
"delay",property) == 0)
4348 flags=ParseGeometry(value,&geometry_info);
4349 if ((flags & GreaterValue) != 0)
4351 if (image->delay > (
size_t) floor(geometry_info.rho+0.5))
4352 image->delay=(size_t) floor(geometry_info.rho+0.5);
4355 if ((flags & LessValue) != 0)
4357 if ((
double) image->delay < floor(geometry_info.rho+0.5))
4358 image->ticks_per_second=CastDoubleToLong(
4359 floor(geometry_info.sigma+0.5));
4362 image->delay=(size_t) floor(geometry_info.rho+0.5);
4363 if ((flags & SigmaValue) != 0)
4364 image->ticks_per_second=CastDoubleToLong(floor(
4365 geometry_info.sigma+0.5));
4368 if (LocaleCompare(
"density",property) == 0)
4373 flags=ParseGeometry(value,&geometry_info);
4374 if ((flags & RhoValue) != 0)
4375 image->x_resolution=geometry_info.rho;
4376 image->y_resolution=image->x_resolution;
4377 if ((flags & SigmaValue) != 0)
4378 image->y_resolution=geometry_info.sigma;
4380 if (LocaleCompare(
"depth",property) == 0)
4382 image->depth=StringToUnsignedLong(value);
4385 if (LocaleCompare(
"dispose",property) == 0)
4390 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,value);
4393 image->dispose=(DisposeType) dispose;
4396 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4397 ConstantString(property),ConstantString(value));
4403 if (LocaleCompare(
"gamma",property) == 0)
4405 image->gamma=StringToDouble(value,(
char **) NULL);
4408 if (LocaleCompare(
"gravity",property) == 0)
4413 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value);
4416 image->gravity=(GravityType) gravity;
4419 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4420 ConstantString(property),ConstantString(value));
4426 if (LocaleCompare(
"intensity",property) == 0)
4431 intensity=ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
4435 image->intensity=(PixelIntensityMethod) intensity;
4438 if (LocaleCompare(
"interpolate",property) == 0)
4443 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
4445 if (interpolate < 0)
4447 image->interpolate=(InterpolatePixelMethod) interpolate;
4450 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4451 ConstantString(property),ConstantString(value));
4457 if (LocaleCompare(
"loop",property) == 0)
4459 image->iterations=StringToUnsignedLong(value);
4462 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4463 ConstantString(property),ConstantString(value));
4469 if (LocaleCompare(
"page",property) == 0)
4474 geometry=GetPageGeometry(value);
4475 flags=ParseAbsoluteGeometry(geometry,&image->page);
4476 geometry=DestroyString(geometry);
4479 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4480 ConstantString(property),ConstantString(value));
4486 if (LocaleCompare(
"rendering-intent",property) == 0)
4491 rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse,
4493 if (rendering_intent < 0)
4495 image->rendering_intent=(RenderingIntent) rendering_intent;
4498 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4499 ConstantString(property),ConstantString(value));
4505 if (LocaleCompare(
"tile-offset",property) == 0)
4510 geometry=GetPageGeometry(value);
4511 flags=ParseAbsoluteGeometry(geometry,&image->tile_offset);
4512 geometry=DestroyString(geometry);
4515 if (LocaleCompare(
"type",property) == 0)
4520 type=ParseCommandOption(MagickTypeOptions,MagickFalse,value);
4522 return(MagickFalse);
4523 image->type=(ImageType) type;
4526 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4527 ConstantString(property),ConstantString(value));
4533 if (LocaleCompare(
"units",property) == 0)
4538 units=ParseCommandOption(MagickResolutionOptions,MagickFalse,value);
4541 image->units=(ResolutionType) units;
4544 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4545 ConstantString(property),ConstantString(value));
4550 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4551 ConstantString(property),ConstantString(value));