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 TAG_EXIF_OFFSET 0x8769
830 #define TAG_GPS_OFFSET 0x8825
831 #define TAG_INTEROP_OFFSET 0xa005
833 #define EXIFMultipleValues(size,format,arg) \
846 for (component=0; component < components; component++) \
848 length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
850 if (length >= (MaxTextExtent-1)) \
851 length=MaxTextExtent-1; \
855 buffer[length-2]='\0'; \
856 value=AcquireString(buffer); \
859 #define EXIFMultipleFractions(size,format,arg1,arg2) \
872 for (component=0; component < components; component++) \
874 length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
875 format", ",(arg1),(arg2)); \
876 if (length >= (MaxTextExtent-1)) \
877 length=MaxTextExtent-1; \
881 buffer[length-2]='\0'; \
882 value=AcquireString(buffer); \
885 typedef struct _DirectoryInfo
897 typedef struct _TagInfo
909 { 0x001,
"exif:InteroperabilityIndex" },
910 { 0x002,
"exif:InteroperabilityVersion" },
911 { 0x100,
"exif:ImageWidth" },
912 { 0x101,
"exif:ImageLength" },
913 { 0x102,
"exif:BitsPerSample" },
914 { 0x103,
"exif:Compression" },
915 { 0x106,
"exif:PhotometricInterpretation" },
916 { 0x10a,
"exif:FillOrder" },
917 { 0x10d,
"exif:DocumentName" },
918 { 0x10e,
"exif:ImageDescription" },
919 { 0x10f,
"exif:Make" },
920 { 0x110,
"exif:Model" },
921 { 0x111,
"exif:StripOffsets" },
922 { 0x112,
"exif:Orientation" },
923 { 0x115,
"exif:SamplesPerPixel" },
924 { 0x116,
"exif:RowsPerStrip" },
925 { 0x117,
"exif:StripByteCounts" },
926 { 0x11a,
"exif:XResolution" },
927 { 0x11b,
"exif:YResolution" },
928 { 0x11c,
"exif:PlanarConfiguration" },
929 { 0x11d,
"exif:PageName" },
930 { 0x11e,
"exif:XPosition" },
931 { 0x11f,
"exif:YPosition" },
932 { 0x118,
"exif:MinSampleValue" },
933 { 0x119,
"exif:MaxSampleValue" },
934 { 0x120,
"exif:FreeOffsets" },
935 { 0x121,
"exif:FreeByteCounts" },
936 { 0x122,
"exif:GrayResponseUnit" },
937 { 0x123,
"exif:GrayResponseCurve" },
938 { 0x124,
"exif:T4Options" },
939 { 0x125,
"exif:T6Options" },
940 { 0x128,
"exif:ResolutionUnit" },
941 { 0x12d,
"exif:TransferFunction" },
942 { 0x131,
"exif:Software" },
943 { 0x132,
"exif:DateTime" },
944 { 0x13b,
"exif:Artist" },
945 { 0x13e,
"exif:WhitePoint" },
946 { 0x13f,
"exif:PrimaryChromaticities" },
947 { 0x140,
"exif:ColorMap" },
948 { 0x141,
"exif:HalfToneHints" },
949 { 0x142,
"exif:TileWidth" },
950 { 0x143,
"exif:TileLength" },
951 { 0x144,
"exif:TileOffsets" },
952 { 0x145,
"exif:TileByteCounts" },
953 { 0x14a,
"exif:SubIFD" },
954 { 0x14c,
"exif:InkSet" },
955 { 0x14d,
"exif:InkNames" },
956 { 0x14e,
"exif:NumberOfInks" },
957 { 0x150,
"exif:DotRange" },
958 { 0x151,
"exif:TargetPrinter" },
959 { 0x152,
"exif:ExtraSample" },
960 { 0x153,
"exif:SampleFormat" },
961 { 0x154,
"exif:SMinSampleValue" },
962 { 0x155,
"exif:SMaxSampleValue" },
963 { 0x156,
"exif:TransferRange" },
964 { 0x157,
"exif:ClipPath" },
965 { 0x158,
"exif:XClipPathUnits" },
966 { 0x159,
"exif:YClipPathUnits" },
967 { 0x15a,
"exif:Indexed" },
968 { 0x15b,
"exif:JPEGTables" },
969 { 0x15f,
"exif:OPIProxy" },
970 { 0x200,
"exif:JPEGProc" },
971 { 0x201,
"exif:JPEGInterchangeFormat" },
972 { 0x202,
"exif:JPEGInterchangeFormatLength" },
973 { 0x203,
"exif:JPEGRestartInterval" },
974 { 0x205,
"exif:JPEGLosslessPredictors" },
975 { 0x206,
"exif:JPEGPointTransforms" },
976 { 0x207,
"exif:JPEGQTables" },
977 { 0x208,
"exif:JPEGDCTables" },
978 { 0x209,
"exif:JPEGACTables" },
979 { 0x211,
"exif:YCbCrCoefficients" },
980 { 0x212,
"exif:YCbCrSubSampling" },
981 { 0x213,
"exif:YCbCrPositioning" },
982 { 0x214,
"exif:ReferenceBlackWhite" },
983 { 0x2bc,
"exif:ExtensibleMetadataPlatform" },
984 { 0x301,
"exif:Gamma" },
985 { 0x302,
"exif:ICCProfileDescriptor" },
986 { 0x303,
"exif:SRGBRenderingIntent" },
987 { 0x320,
"exif:ImageTitle" },
988 { 0x5001,
"exif:ResolutionXUnit" },
989 { 0x5002,
"exif:ResolutionYUnit" },
990 { 0x5003,
"exif:ResolutionXLengthUnit" },
991 { 0x5004,
"exif:ResolutionYLengthUnit" },
992 { 0x5005,
"exif:PrintFlags" },
993 { 0x5006,
"exif:PrintFlagsVersion" },
994 { 0x5007,
"exif:PrintFlagsCrop" },
995 { 0x5008,
"exif:PrintFlagsBleedWidth" },
996 { 0x5009,
"exif:PrintFlagsBleedWidthScale" },
997 { 0x500A,
"exif:HalftoneLPI" },
998 { 0x500B,
"exif:HalftoneLPIUnit" },
999 { 0x500C,
"exif:HalftoneDegree" },
1000 { 0x500D,
"exif:HalftoneShape" },
1001 { 0x500E,
"exif:HalftoneMisc" },
1002 { 0x500F,
"exif:HalftoneScreen" },
1003 { 0x5010,
"exif:JPEGQuality" },
1004 { 0x5011,
"exif:GridSize" },
1005 { 0x5012,
"exif:ThumbnailFormat" },
1006 { 0x5013,
"exif:ThumbnailWidth" },
1007 { 0x5014,
"exif:ThumbnailHeight" },
1008 { 0x5015,
"exif:ThumbnailColorDepth" },
1009 { 0x5016,
"exif:ThumbnailPlanes" },
1010 { 0x5017,
"exif:ThumbnailRawBytes" },
1011 { 0x5018,
"exif:ThumbnailSize" },
1012 { 0x5019,
"exif:ThumbnailCompressedSize" },
1013 { 0x501a,
"exif:ColorTransferFunction" },
1014 { 0x501b,
"exif:ThumbnailData" },
1015 { 0x5020,
"exif:ThumbnailImageWidth" },
1016 { 0x5021,
"exif:ThumbnailImageHeight" },
1017 { 0x5022,
"exif:ThumbnailBitsPerSample" },
1018 { 0x5023,
"exif:ThumbnailCompression" },
1019 { 0x5024,
"exif:ThumbnailPhotometricInterp" },
1020 { 0x5025,
"exif:ThumbnailImageDescription" },
1021 { 0x5026,
"exif:ThumbnailEquipMake" },
1022 { 0x5027,
"exif:ThumbnailEquipModel" },
1023 { 0x5028,
"exif:ThumbnailStripOffsets" },
1024 { 0x5029,
"exif:ThumbnailOrientation" },
1025 { 0x502a,
"exif:ThumbnailSamplesPerPixel" },
1026 { 0x502b,
"exif:ThumbnailRowsPerStrip" },
1027 { 0x502c,
"exif:ThumbnailStripBytesCount" },
1028 { 0x502d,
"exif:ThumbnailResolutionX" },
1029 { 0x502e,
"exif:ThumbnailResolutionY" },
1030 { 0x502f,
"exif:ThumbnailPlanarConfig" },
1031 { 0x5030,
"exif:ThumbnailResolutionUnit" },
1032 { 0x5031,
"exif:ThumbnailTransferFunction" },
1033 { 0x5032,
"exif:ThumbnailSoftwareUsed" },
1034 { 0x5033,
"exif:ThumbnailDateTime" },
1035 { 0x5034,
"exif:ThumbnailArtist" },
1036 { 0x5035,
"exif:ThumbnailWhitePoint" },
1037 { 0x5036,
"exif:ThumbnailPrimaryChromaticities" },
1038 { 0x5037,
"exif:ThumbnailYCbCrCoefficients" },
1039 { 0x5038,
"exif:ThumbnailYCbCrSubsampling" },
1040 { 0x5039,
"exif:ThumbnailYCbCrPositioning" },
1041 { 0x503A,
"exif:ThumbnailRefBlackWhite" },
1042 { 0x503B,
"exif:ThumbnailCopyRight" },
1043 { 0x5090,
"exif:LuminanceTable" },
1044 { 0x5091,
"exif:ChrominanceTable" },
1045 { 0x5100,
"exif:FrameDelay" },
1046 { 0x5101,
"exif:LoopCount" },
1047 { 0x5110,
"exif:PixelUnit" },
1048 { 0x5111,
"exif:PixelPerUnitX" },
1049 { 0x5112,
"exif:PixelPerUnitY" },
1050 { 0x5113,
"exif:PaletteHistogram" },
1051 { 0x1000,
"exif:RelatedImageFileFormat" },
1052 { 0x1001,
"exif:RelatedImageLength" },
1053 { 0x1002,
"exif:RelatedImageWidth" },
1054 { 0x800d,
"exif:ImageID" },
1055 { 0x80e3,
"exif:Matteing" },
1056 { 0x80e4,
"exif:DataType" },
1057 { 0x80e5,
"exif:ImageDepth" },
1058 { 0x80e6,
"exif:TileDepth" },
1059 { 0x828d,
"exif:CFARepeatPatternDim" },
1060 { 0x828e,
"exif:CFAPattern2" },
1061 { 0x828f,
"exif:BatteryLevel" },
1062 { 0x8298,
"exif:Copyright" },
1063 { 0x829a,
"exif:ExposureTime" },
1064 { 0x829d,
"exif:FNumber" },
1065 { 0x83bb,
"exif:IPTC/NAA" },
1066 { 0x84e3,
"exif:IT8RasterPadding" },
1067 { 0x84e5,
"exif:IT8ColorTable" },
1068 { 0x8649,
"exif:ImageResourceInformation" },
1069 { 0x8769,
"exif:ExifOffset" },
1070 { 0x8773,
"exif:InterColorProfile" },
1071 { 0x8822,
"exif:ExposureProgram" },
1072 { 0x8824,
"exif:SpectralSensitivity" },
1073 { 0x8825,
"exif:GPSInfo" },
1074 { 0x8827,
"exif:PhotographicSensitivity" },
1075 { 0x8828,
"exif:OECF" },
1076 { 0x8829,
"exif:Interlace" },
1077 { 0x882a,
"exif:TimeZoneOffset" },
1078 { 0x882b,
"exif:SelfTimerMode" },
1079 { 0x8830,
"exif:SensitivityType" },
1080 { 0x8831,
"exif:StandardOutputSensitivity" },
1081 { 0x8832,
"exif:RecommendedExposureIndex" },
1082 { 0x8833,
"exif:ISOSpeed" },
1083 { 0x8834,
"exif:ISOSpeedLatitudeyyy" },
1084 { 0x8835,
"exif:ISOSpeedLatitudezzz" },
1085 { 0x9000,
"exif:ExifVersion" },
1086 { 0x9003,
"exif:DateTimeOriginal" },
1087 { 0x9004,
"exif:DateTimeDigitized" },
1088 { 0x9010,
"exif:OffsetTime" },
1089 { 0x9011,
"exif:OffsetTimeOriginal" },
1090 { 0x9012,
"exif:OffsetTimeDigitized" },
1091 { 0x9101,
"exif:ComponentsConfiguration" },
1092 { 0x9102,
"exif:CompressedBitsPerPixel" },
1093 { 0x9201,
"exif:ShutterSpeedValue" },
1094 { 0x9202,
"exif:ApertureValue" },
1095 { 0x9203,
"exif:BrightnessValue" },
1096 { 0x9204,
"exif:ExposureBiasValue" },
1097 { 0x9205,
"exif:MaxApertureValue" },
1098 { 0x9206,
"exif:SubjectDistance" },
1099 { 0x9207,
"exif:MeteringMode" },
1100 { 0x9208,
"exif:LightSource" },
1101 { 0x9209,
"exif:Flash" },
1102 { 0x920a,
"exif:FocalLength" },
1103 { 0x920b,
"exif:FlashEnergy" },
1104 { 0x920c,
"exif:SpatialFrequencyResponse" },
1105 { 0x920d,
"exif:Noise" },
1106 { 0x9214,
"exif:SubjectArea" },
1107 { 0x9290,
"exif:SubSecTime" },
1108 { 0x9291,
"exif:SubSecTimeOriginal" },
1109 { 0x9292,
"exif:SubSecTimeDigitized" },
1110 { 0x9211,
"exif:ImageNumber" },
1111 { 0x9212,
"exif:SecurityClassification" },
1112 { 0x9213,
"exif:ImageHistory" },
1113 { 0x9214,
"exif:SubjectArea" },
1114 { 0x9215,
"exif:ExposureIndex" },
1115 { 0x9216,
"exif:TIFF-EPStandardID" },
1116 { 0x927c,
"exif:MakerNote" },
1117 { 0x9286,
"exif:UserComment" },
1118 { 0x9290,
"exif:SubSecTime" },
1119 { 0x9291,
"exif:SubSecTimeOriginal" },
1120 { 0x9292,
"exif:SubSecTimeDigitized" },
1121 { 0x9400,
"exif:Temperature" },
1122 { 0x9401,
"exif:Humidity" },
1123 { 0x9402,
"exif:Pressure" },
1124 { 0x9403,
"exif:WaterDepth" },
1125 { 0x9404,
"exif:Acceleration" },
1126 { 0x9405,
"exif:CameraElevationAngle" },
1127 { 0x9C9b,
"exif:WinXP-Title" },
1128 { 0x9C9c,
"exif:WinXP-Comments" },
1129 { 0x9C9d,
"exif:WinXP-Author" },
1130 { 0x9C9e,
"exif:WinXP-Keywords" },
1131 { 0x9C9f,
"exif:WinXP-Subject" },
1132 { 0xa000,
"exif:FlashPixVersion" },
1133 { 0xa001,
"exif:ColorSpace" },
1134 { 0xa002,
"exif:PixelXDimension" },
1135 { 0xa003,
"exif:PixelYDimension" },
1136 { 0xa004,
"exif:RelatedSoundFile" },
1137 { 0xa005,
"exif:InteroperabilityOffset" },
1138 { 0xa20b,
"exif:FlashEnergy" },
1139 { 0xa20c,
"exif:SpatialFrequencyResponse" },
1140 { 0xa20d,
"exif:Noise" },
1141 { 0xa20e,
"exif:FocalPlaneXResolution" },
1142 { 0xa20f,
"exif:FocalPlaneYResolution" },
1143 { 0xa210,
"exif:FocalPlaneResolutionUnit" },
1144 { 0xa214,
"exif:SubjectLocation" },
1145 { 0xa215,
"exif:ExposureIndex" },
1146 { 0xa216,
"exif:TIFF/EPStandardID" },
1147 { 0xa217,
"exif:SensingMethod" },
1148 { 0xa300,
"exif:FileSource" },
1149 { 0xa301,
"exif:SceneType" },
1150 { 0xa302,
"exif:CFAPattern" },
1151 { 0xa401,
"exif:CustomRendered" },
1152 { 0xa402,
"exif:ExposureMode" },
1153 { 0xa403,
"exif:WhiteBalance" },
1154 { 0xa404,
"exif:DigitalZoomRatio" },
1155 { 0xa405,
"exif:FocalLengthIn35mmFilm" },
1156 { 0xa406,
"exif:SceneCaptureType" },
1157 { 0xa407,
"exif:GainControl" },
1158 { 0xa408,
"exif:Contrast" },
1159 { 0xa409,
"exif:Saturation" },
1160 { 0xa40a,
"exif:Sharpness" },
1161 { 0xa40b,
"exif:DeviceSettingDescription" },
1162 { 0xa40c,
"exif:SubjectDistanceRange" },
1163 { 0xa420,
"exif:ImageUniqueID" },
1164 { 0xa430,
"exif:CameraOwnerName" },
1165 { 0xa431,
"exif:BodySerialNumber" },
1166 { 0xa432,
"exif:LensSpecification" },
1167 { 0xa433,
"exif:LensMake" },
1168 { 0xa434,
"exif:LensModel" },
1169 { 0xa435,
"exif:LensSerialNumber" },
1170 { 0xc4a5,
"exif:PrintImageMatching" },
1171 { 0xa500,
"exif:Gamma" },
1172 { 0xc640,
"exif:CR2Slice" },
1173 { 0x10000,
"exif:GPSVersionID" },
1174 { 0x10001,
"exif:GPSLatitudeRef" },
1175 { 0x10002,
"exif:GPSLatitude" },
1176 { 0x10003,
"exif:GPSLongitudeRef" },
1177 { 0x10004,
"exif:GPSLongitude" },
1178 { 0x10005,
"exif:GPSAltitudeRef" },
1179 { 0x10006,
"exif:GPSAltitude" },
1180 { 0x10007,
"exif:GPSTimeStamp" },
1181 { 0x10008,
"exif:GPSSatellites" },
1182 { 0x10009,
"exif:GPSStatus" },
1183 { 0x1000a,
"exif:GPSMeasureMode" },
1184 { 0x1000b,
"exif:GPSDop" },
1185 { 0x1000c,
"exif:GPSSpeedRef" },
1186 { 0x1000d,
"exif:GPSSpeed" },
1187 { 0x1000e,
"exif:GPSTrackRef" },
1188 { 0x1000f,
"exif:GPSTrack" },
1189 { 0x10010,
"exif:GPSImgDirectionRef" },
1190 { 0x10011,
"exif:GPSImgDirection" },
1191 { 0x10012,
"exif:GPSMapDatum" },
1192 { 0x10013,
"exif:GPSDestLatitudeRef" },
1193 { 0x10014,
"exif:GPSDestLatitude" },
1194 { 0x10015,
"exif:GPSDestLongitudeRef" },
1195 { 0x10016,
"exif:GPSDestLongitude" },
1196 { 0x10017,
"exif:GPSDestBearingRef" },
1197 { 0x10018,
"exif:GPSDestBearing" },
1198 { 0x10019,
"exif:GPSDestDistanceRef" },
1199 { 0x1001a,
"exif:GPSDestDistance" },
1200 { 0x1001b,
"exif:GPSProcessingMethod" },
1201 { 0x1001c,
"exif:GPSAreaInformation" },
1202 { 0x1001d,
"exif:GPSDateStamp" },
1203 { 0x1001e,
"exif:GPSDifferential" },
1204 { 0x1001f,
"exif:GPSHPositioningError" },
1216 directory_stack[MaxDirectoryStack] = {{ 0 }};
1245 tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
1250 profile=GetImageProfile(image,
"exif");
1252 return(MagickFalse);
1253 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1254 return(MagickFalse);
1255 while (isspace((
int) ((
unsigned char) *property)) != 0)
1257 if (strlen(property) <= 5)
1258 return(MagickFalse);
1261 switch (*(property+5))
1290 tag=(*(
property+5) ==
'@') ? 1UL : 0UL;
1294 return(MagickFalse);
1301 for (i=(ssize_t) n-1L; i >= 0; i--)
1305 if ((c >=
'0') && (c <=
'9'))
1308 if ((c >=
'A') && (c <=
'F'))
1311 if ((c >=
'a') && (c <=
'f'))
1314 return(MagickFalse);
1316 }
while (*property !=
'\0');
1326 if (EXIFTag[i].tag == 0)
1328 if (LocaleCompare(EXIFTag[i].description,property) == 0)
1330 tag=(size_t) EXIFTag[i].tag;
1338 return(MagickFalse);
1339 length=GetStringInfoLength(profile);
1341 return(MagickFalse);
1342 exif=GetStringInfoDatum(profile);
1345 if (ReadPropertyByte(&exif,&length) != 0x45)
1347 if (ReadPropertyByte(&exif,&length) != 0x78)
1349 if (ReadPropertyByte(&exif,&length) != 0x69)
1351 if (ReadPropertyByte(&exif,&length) != 0x66)
1353 if (ReadPropertyByte(&exif,&length) != 0x00)
1355 if (ReadPropertyByte(&exif,&length) != 0x00)
1360 return(MagickFalse);
1361 id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif);
1369 return(MagickFalse);
1370 if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a)
1371 return(MagickFalse);
1375 offset=(ssize_t) ReadPropertySignedLong(endian,exif+4);
1376 if ((offset < 0) || (size_t) offset >= length)
1377 return(MagickFalse);
1382 directory=exif+offset;
1386 exif_resources=NewSplayTree((
int (*)(
const void *,
const void *)) NULL,
1387 (
void *(*)(
void *)) NULL,(
void *(*)(
void *)) NULL);
1396 directory=directory_stack[level].directory;
1397 entry=directory_stack[level].entry;
1398 tag_offset=directory_stack[level].offset;
1400 if ((directory < exif) || (directory > (exif+length-2)))
1405 number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory);
1406 for ( ; entry < number_entries; entry++)
1419 q=(
unsigned char *) (directory+(12*entry)+2);
1420 if (q > (exif+length-12))
1422 if (GetValueFromSplayTree(exif_resources,q) == q)
1424 (void) AddValueToSplayTree(exif_resources,q,q);
1425 tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset;
1426 format=(size_t) ReadPropertyUnsignedShort(endian,q+2);
1427 if (format >= (
sizeof(tag_bytes)/
sizeof(*tag_bytes)))
1431 components=(ssize_t) ReadPropertySignedLong(endian,q+4);
1434 number_bytes=(size_t) components*tag_bytes[format];
1435 if (number_bytes < components)
1437 if (number_bytes <= 4)
1447 dir_offset=(ssize_t) ReadPropertySignedLong(endian,q+8);
1448 if ((dir_offset < 0) || (size_t) dir_offset >= length)
1450 if (((
size_t) dir_offset+number_bytes) < (
size_t) dir_offset)
1452 if (((
size_t) dir_offset+number_bytes) > length)
1454 p=(
unsigned char *) (exif+dir_offset);
1456 if ((all != 0) || (tag == (size_t) tag_value))
1459 buffer[MaxTextExtent],
1462 if ((p < exif) || (p > (exif+length-tag_bytes[format])))
1464 value=(
char *) NULL;
1469 case EXIF_FMT_UNDEFINED:
1471 value=(
char *) NULL;
1472 if (~((
size_t) number_bytes) >= 1)
1473 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1475 if (value != (
char *) NULL)
1477 for (i=0; i < (ssize_t) number_bytes; i++)
1480 if (isprint((
int) p[i]) != 0)
1481 value[i]=(char) p[i];
1487 case EXIF_FMT_SBYTE:
1489 EXIFMultipleValues(1,
"%.20g",(
double) (*(
signed char *) p1));
1492 case EXIF_FMT_SSHORT:
1494 EXIFMultipleValues(2,
"%hd",ReadPropertySignedShort(endian,p1));
1497 case EXIF_FMT_USHORT:
1499 EXIFMultipleValues(2,
"%hu",ReadPropertyUnsignedShort(endian,p1));
1502 case EXIF_FMT_ULONG:
1504 EXIFMultipleValues(4,
"%.20g",(
double)
1505 ReadPropertyUnsignedLong(endian,p1));
1508 case EXIF_FMT_SLONG:
1510 EXIFMultipleValues(4,
"%.20g",(
double)
1511 ReadPropertySignedLong(endian,p1));
1514 case EXIF_FMT_URATIONAL:
1516 EXIFMultipleFractions(8,
"%.20g/%.20g",(
double)
1517 ReadPropertyUnsignedLong(endian,p1),(
double)
1518 ReadPropertyUnsignedLong(endian,p1+4));
1521 case EXIF_FMT_SRATIONAL:
1523 EXIFMultipleFractions(8,
"%.20g/%.20g",(
double)
1524 ReadPropertySignedLong(endian,p1),(
double)
1525 ReadPropertySignedLong(endian,p1+4));
1528 case EXIF_FMT_SINGLE:
1530 EXIFMultipleValues(4,
"%.20g",(
double)
1531 ReadPropertySignedLong(endian,p1));
1534 case EXIF_FMT_DOUBLE:
1536 EXIFMultipleValues(8,
"%.20g",(
double)
1537 ReadPropertySignedLong(endian,p1));
1540 case EXIF_FMT_STRING:
1543 if ((p < exif) || (p > (exif+length-number_bytes)))
1545 value=(
char *) NULL;
1546 if (~((
size_t) number_bytes) >= 1)
1547 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1549 if (value != (
char *) NULL)
1554 for (i=0; i < (ssize_t) number_bytes; i++)
1557 if ((isprint((
int) p[i]) != 0) || (p[i] ==
'\0'))
1558 value[i]=(char) p[i];
1565 if (value != (
char *) NULL)
1573 key=AcquireString(property);
1584 description=
"unknown";
1587 if (EXIFTag[i].tag == 0)
1589 if (EXIFTag[i].tag == tag_value)
1591 description=EXIFTag[i].description;
1595 (void) FormatLocaleString(key,MaxTextExtent,
"%s",
1598 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1603 if (tag_value < 0x10000)
1604 (void) FormatLocaleString(key,MaxTextExtent,
"#%04lx",
1605 (
unsigned long) tag_value);
1607 if (tag_value < 0x20000)
1608 (void) FormatLocaleString(key,MaxTextExtent,
"@%04lx",
1609 (
unsigned long) (tag_value & 0xffff));
1611 (
void) FormatLocaleString(key,MaxTextExtent,
"unknown");
1617 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1620 p=(
const char *) NULL;
1621 if (image->properties != (
void *) NULL)
1623 image->properties,key);
1624 if (p == (
const char *) NULL)
1625 (void) SetImageProperty((
Image *) image,key,value);
1626 value=DestroyString(value);
1627 key=DestroyString(key);
1631 if ((tag_value == TAG_EXIF_OFFSET) ||
1632 (tag_value == TAG_INTEROP_OFFSET) || (tag_value == TAG_GPS_OFFSET))
1637 offset=(ssize_t) ReadPropertySignedLong(endian,p);
1638 if (((
size_t) offset < length) && (level < (MaxDirectoryStack-2)))
1643 tag_offset1=(ssize_t) ((tag_value == TAG_GPS_OFFSET) ? 0x10000 :
1645 directory_stack[level].directory=directory;
1647 directory_stack[level].entry=entry;
1648 directory_stack[level].offset=tag_offset;
1653 for (i=0; i < level; i++)
1654 if (directory_stack[i].directory == (exif+tag_offset1))
1658 directory_stack[level].directory=exif+offset;
1659 directory_stack[level].offset=tag_offset1;
1660 directory_stack[level].entry=0;
1662 if ((directory+2+(12*number_entries)+4) > (exif+length))
1664 offset=(ssize_t) ReadPropertySignedLong(endian,directory+2+(12*
1666 if ((offset != 0) && ((size_t) offset < length) &&
1667 (level < (MaxDirectoryStack-2)))
1669 directory_stack[level].directory=exif+offset;
1670 directory_stack[level].entry=0;
1671 directory_stack[level].offset=tag_offset1;
1678 }
while (level > 0);
1679 exif_resources=DestroySplayTree(exif_resources);
1683 static MagickBooleanType GetICCProperty(
const Image *image,
const char *property)
1691 magick_unreferenced(property);
1692 profile=GetImageProfile(image,
"icc");
1694 profile=GetImageProfile(image,
"icm");
1696 return(MagickFalse);
1697 if (GetStringInfoLength(profile) < 128)
1698 return(MagickFalse);
1699 #if defined(MAGICKCORE_LCMS_DELEGATE)
1704 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
1705 (cmsUInt32Number) GetStringInfoLength(profile));
1706 if (icc_profile != (cmsHPROFILE *) NULL)
1708 #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
1712 name=cmsTakeProductName(icc_profile);
1713 if (name != (
const char *) NULL)
1714 (void) SetImageProperty((
Image *) image,
"icc:name",name);
1722 info=AcquireStringInfo(0);
1723 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
"US",
1727 SetStringInfoLength(info,extent+1);
1728 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
1729 "US",(
char *) GetStringInfoDatum(info),extent);
1731 (void) SetImageProperty((
Image *) image,
"icc:description",
1732 (
char *) GetStringInfoDatum(info));
1734 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
"US",
1738 SetStringInfoLength(info,extent+1);
1739 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
1740 "US",(
char *) GetStringInfoDatum(info),extent);
1742 (void) SetImageProperty((
Image *) image,
"icc:manufacturer",
1743 (
char *) GetStringInfoDatum(info));
1745 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1749 SetStringInfoLength(info,extent+1);
1750 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1751 (
char *) GetStringInfoDatum(info),extent);
1753 (void) SetImageProperty((
Image *) image,
"icc:model",
1754 (
char *) GetStringInfoDatum(info));
1756 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
"US",
1760 SetStringInfoLength(info,extent+1);
1761 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
1762 "US",(
char *) GetStringInfoDatum(info),extent);
1764 (void) SetImageProperty((
Image *) image,
"icc:copyright",
1765 (
char *) GetStringInfoDatum(info));
1767 info=DestroyStringInfo(info);
1769 (void) cmsCloseProfile(icc_profile);
1776 static MagickBooleanType SkipXMPValue(
const char *value)
1778 if (value == (
const char*) NULL)
1780 while (*value !=
'\0')
1782 if (isspace((
int) ((
unsigned char) *value)) == 0)
1783 return(MagickFalse);
1789 static MagickBooleanType GetXMPProperty(
const Image *image,
const char *property)
1816 profile=GetImageProfile(image,
"xmp");
1818 return(MagickFalse);
1819 if (GetStringInfoLength(profile) < 17)
1820 return(MagickFalse);
1821 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1822 return(MagickFalse);
1823 xmp_profile=StringInfoToString(profile);
1824 if (xmp_profile == (
char *) NULL)
1825 return(MagickFalse);
1826 for (p=xmp_profile; *p !=
'\0'; p++)
1827 if ((*p ==
'<') && (*(p+1) ==
'x'))
1829 exception=AcquireExceptionInfo();
1830 xmp=NewXMLTree((
char *) p,exception);
1831 xmp_profile=DestroyString(xmp_profile);
1832 exception=DestroyExceptionInfo(exception);
1834 return(MagickFalse);
1836 rdf=GetXMLTreeChild(xmp,
"rdf:RDF");
1839 if (image->properties == (
void *) NULL)
1840 ((
Image *) image)->properties=NewSplayTree(CompareSplayTreeString,
1841 RelinquishMagickMemory,RelinquishMagickMemory);
1842 description=GetXMLTreeChild(rdf,
"rdf:Description");
1845 node=GetXMLTreeChild(description,(
const char *) NULL);
1851 child=GetXMLTreeChild(node,(
const char *) NULL);
1852 content=GetXMLTreeContent(node);
1854 (SkipXMPValue(content) == MagickFalse))
1856 xmp_namespace=ConstantString(GetXMLTreeTag(node));
1857 (void) SubstituteString(&xmp_namespace,
"exif:",
"xmp:");
1858 (void) AddValueToSplayTree((
SplayTreeInfo *) image->properties,
1859 xmp_namespace,ConstantString(content));
1863 content=GetXMLTreeContent(child);
1864 if (SkipXMPValue(content) == MagickFalse)
1866 xmp_namespace=ConstantString(GetXMLTreeTag(node));
1867 (void) SubstituteString(&xmp_namespace,
"exif:",
"xmp:");
1868 (void) AddValueToSplayTree((
SplayTreeInfo *) image->properties,
1869 xmp_namespace,ConstantString(content));
1871 child=GetXMLTreeSibling(child);
1873 node=GetXMLTreeSibling(node);
1875 description=GetNextXMLTreeTag(description);
1878 xmp=DestroyXMLTree(xmp);
1882 static char *TracePSClippath(
const unsigned char *blob,
size_t length,
1883 const size_t magick_unused(columns),
const size_t magick_unused(rows))
1906 magick_unreferenced(columns);
1907 magick_unreferenced(rows);
1909 path=AcquireString((
char *) NULL);
1910 if (path == (
char *) NULL)
1911 return((
char *) NULL);
1912 message=AcquireString((
char *) NULL);
1913 (void) FormatLocaleString(message,MaxTextExtent,
"/ClipImage\n");
1914 (void) ConcatenateString(&path,message);
1915 (void) FormatLocaleString(message,MaxTextExtent,
"{\n");
1916 (void) ConcatenateString(&path,message);
1917 (void) FormatLocaleString(message,MaxTextExtent,
" /c {curveto} bind def\n");
1918 (void) ConcatenateString(&path,message);
1919 (void) FormatLocaleString(message,MaxTextExtent,
" /l {lineto} bind def\n");
1920 (void) ConcatenateString(&path,message);
1921 (void) FormatLocaleString(message,MaxTextExtent,
" /m {moveto} bind def\n");
1922 (void) ConcatenateString(&path,message);
1923 (void) FormatLocaleString(message,MaxTextExtent,
1924 " /v {currentpoint 6 2 roll curveto} bind def\n");
1925 (void) ConcatenateString(&path,message);
1926 (void) FormatLocaleString(message,MaxTextExtent,
1927 " /y {2 copy curveto} bind def\n");
1928 (void) ConcatenateString(&path,message);
1929 (void) FormatLocaleString(message,MaxTextExtent,
1930 " /z {closepath} bind def\n");
1931 (void) ConcatenateString(&path,message);
1932 (void) FormatLocaleString(message,MaxTextExtent,
" newpath\n");
1933 (void) ConcatenateString(&path,message);
1938 (void) memset(point,0,
sizeof(point));
1939 (void) memset(first,0,
sizeof(first));
1940 (void) memset(last,0,
sizeof(last));
1942 in_subpath=MagickFalse;
1945 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
1951 if (knot_count != 0)
1954 length-=MagickMin(24,(ssize_t) length);
1960 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
1962 length-=MagickMin(22,(ssize_t) length);
1970 if (knot_count == 0)
1976 length-=MagickMin(24,(ssize_t) length);
1982 for (i=0; i < 3; i++)
1984 y=(size_t) ReadPropertyMSBLong(&blob,&length);
1985 x=(size_t) ReadPropertyMSBLong(&blob,&length);
1986 point[i].x=(double) x/4096.0/4096.0;
1987 point[i].y=1.0-(double) y/4096.0/4096.0;
1989 if (in_subpath == MagickFalse)
1991 (void) FormatLocaleString(message,MaxTextExtent,
" %g %g m\n",
1992 point[1].x,point[1].y);
1993 for (i=0; i < 3; i++)
2005 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2006 (point[0].x == point[1].x) && (point[0].y == point[1].y))
2007 (void) FormatLocaleString(message,MaxTextExtent,
2008 " %g %g l\n",point[1].x,point[1].y);
2010 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2011 (void) FormatLocaleString(message,MaxTextExtent,
2012 " %g %g %g %g v\n",point[0].x,point[0].y,
2013 point[1].x,point[1].y);
2015 if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
2016 (void) FormatLocaleString(message,MaxTextExtent,
2017 " %g %g %g %g y\n",last[2].x,last[2].y,
2018 point[1].x,point[1].y);
2020 (
void) FormatLocaleString(message,MaxTextExtent,
2021 " %g %g %g %g %g %g c\n",last[2].x,
2022 last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
2023 for (i=0; i < 3; i++)
2026 (void) ConcatenateString(&path,message);
2027 in_subpath=MagickTrue;
2032 if (knot_count == 0)
2038 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2039 (first[0].x == first[1].x) && (first[0].y == first[1].y))
2040 (void) FormatLocaleString(message,MaxTextExtent,
2041 " %g %g l z\n",first[1].x,first[1].y);
2043 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2044 (void) FormatLocaleString(message,MaxTextExtent,
2045 " %g %g %g %g v z\n",first[0].x,first[0].y,
2046 first[1].x,first[1].y);
2048 if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
2049 (void) FormatLocaleString(message,MaxTextExtent,
2050 " %g %g %g %g y z\n",last[2].x,last[2].y,
2051 first[1].x,first[1].y);
2053 (
void) FormatLocaleString(message,MaxTextExtent,
2054 " %g %g %g %g %g %g c z\n",last[2].x,
2055 last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
2056 (void) ConcatenateString(&path,message);
2057 in_subpath=MagickFalse;
2067 length-=MagickMin(24,(ssize_t) length);
2075 (void) FormatLocaleString(message,MaxTextExtent,
" eoclip\n");
2076 (void) ConcatenateString(&path,message);
2077 (void) FormatLocaleString(message,MaxTextExtent,
"} bind def");
2078 (void) ConcatenateString(&path,message);
2079 message=DestroyString(message);
2083 static inline void TraceBezierCurve(
char *message,
PointInfo *last,
2090 if (((last+1)->x == (last+2)->x) && ((last+1)->y == (last+2)->y) &&
2091 (point->x == (point+1)->x) && (point->y == (point+1)->y))
2092 (void) FormatLocaleString(message,MagickPathExtent,
2093 "L %g %g\n",point[1].x,point[1].y);
2095 (
void) FormatLocaleString(message,MagickPathExtent,
"C %g %g %g %g %g %g\n",
2096 (last+2)->x,(last+2)->y,point->x,point->y,(point+1)->x,(point+1)->y);
2099 static char *TraceSVGClippath(
const unsigned char *blob,
size_t length,
2100 const size_t columns,
const size_t rows)
2123 path=AcquireString((
char *) NULL);
2124 if (path == (
char *) NULL)
2125 return((
char *) NULL);
2126 message=AcquireString((
char *) NULL);
2127 (void) FormatLocaleString(message,MaxTextExtent,(
2128 "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
2129 "<svg xmlns=\"http://www.w3.org/2000/svg\""
2130 " width=\"%.20g\" height=\"%.20g\">\n"
2132 "<path fill-rule=\"evenodd\" style=\"fill:#000000;stroke:#000000;"
2133 "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),(double) columns,
2135 (void) ConcatenateString(&path,message);
2136 (void) memset(point,0,
sizeof(point));
2137 (void) memset(first,0,
sizeof(first));
2138 (void) memset(last,0,
sizeof(last));
2140 in_subpath=MagickFalse;
2143 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2149 if (knot_count != 0)
2152 length-=MagickMin(24,(ssize_t) length);
2158 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2160 length-=MagickMin(22,(ssize_t) length);
2168 if (knot_count == 0)
2174 length-=MagickMin(24,(ssize_t) length);
2180 for (i=0; i < 3; i++)
2182 y=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2183 x=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2184 point[i].x=(double) x*columns/4096.0/4096.0;
2185 point[i].y=(double) y*rows/4096.0/4096.0;
2187 if (in_subpath == MagickFalse)
2189 (void) FormatLocaleString(message,MaxTextExtent,
"M %g %g\n",
2190 point[1].x,point[1].y);
2191 for (i=0; i < 3; i++)
2199 TraceBezierCurve(message,last,point);
2200 for (i=0; i < 3; i++)
2203 (void) ConcatenateString(&path,message);
2204 in_subpath=MagickTrue;
2209 if (knot_count == 0)
2211 TraceBezierCurve(message,last,first);
2212 (void) ConcatenateString(&path,message);
2213 in_subpath=MagickFalse;
2223 length-=MagickMin(24,(ssize_t) length);
2231 (void) ConcatenateString(&path,
"\"/>\n</g>\n</svg>\n");
2232 message=DestroyString(message);
2236 MagickExport
const char *GetImageProperty(
const Image *image,
2237 const char *property)
2254 assert(image != (
Image *) NULL);
2255 assert(image->signature == MagickCoreSignature);
2256 if (IsEventLogging() != MagickFalse)
2257 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2258 p=(
const char *) NULL;
2259 if (image->properties != (
void *) NULL)
2261 if (property == (
const char *) NULL)
2263 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
2268 if (LocaleNCompare(
"fx:",property,3) != 0)
2271 image->properties,property);
2272 if (p != (
const char *) NULL)
2276 if ((property == (
const char *) NULL) ||
2277 (strchr(property,
':') == (
char *) NULL))
2279 exception=(&((
Image *) image)->exception);
2284 if (LocaleNCompare(
"8bim:",property,5) == 0)
2286 (void) Get8BIMProperty(image,property);
2294 if (LocaleNCompare(
"exif:",property,5) == 0)
2296 (void) GetEXIFProperty(image,property);
2304 if (LocaleNCompare(
"fx:",property,3) == 0)
2306 if ((image->columns == 0) || (image->rows == 0))
2308 fx_info=AcquireFxInfo(image,property+3);
2309 status=FxEvaluateChannelExpression(fx_info,DefaultChannels,0,0,&alpha,
2311 fx_info=DestroyFxInfo(fx_info);
2312 if (status != MagickFalse)
2315 value[MaxTextExtent];
2317 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
2318 GetMagickPrecision(),(double) alpha);
2319 (void) SetImageProperty((
Image *) image,property,value);
2328 if (LocaleNCompare(
"hex:",property,4) == 0)
2333 if ((image->columns == 0) || (image->rows == 0))
2335 GetMagickPixelPacket(image,&pixel);
2336 fx_info=AcquireFxInfo(image,property+4);
2337 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2339 pixel.red=(MagickRealType) QuantumRange*alpha;
2340 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2342 pixel.green=(MagickRealType) QuantumRange*alpha;
2343 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2345 pixel.blue=(MagickRealType) QuantumRange*alpha;
2346 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2348 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2349 if (image->colorspace == CMYKColorspace)
2351 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2353 pixel.index=(MagickRealType) QuantumRange*alpha;
2355 fx_info=DestroyFxInfo(fx_info);
2356 if (status != MagickFalse)
2361 GetColorTuple(&pixel,MagickTrue,hex);
2362 (void) SetImageProperty((
Image *) image,property,hex+1);
2371 if ((LocaleNCompare(
"icc:",property,4) == 0) ||
2372 (LocaleNCompare(
"icm:",property,4) == 0))
2374 (void) GetICCProperty(image,property);
2377 if (LocaleNCompare(
"iptc:",property,5) == 0)
2379 (void) GetIPTCProperty(image,property);
2387 if (LocaleNCompare(
"pixel:",property,6) == 0)
2392 GetMagickPixelPacket(image,&pixel);
2393 fx_info=AcquireFxInfo(image,property+6);
2394 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2396 pixel.red=(MagickRealType) QuantumRange*alpha;
2397 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2399 pixel.green=(MagickRealType) QuantumRange*alpha;
2400 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2402 pixel.blue=(MagickRealType) QuantumRange*alpha;
2403 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2405 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2406 if (image->colorspace == CMYKColorspace)
2408 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2410 pixel.index=(MagickRealType) QuantumRange*alpha;
2412 fx_info=DestroyFxInfo(fx_info);
2413 if (status != MagickFalse)
2416 name[MaxTextExtent];
2421 GetColorTuple(&pixel,MagickFalse,name);
2422 value=GetImageArtifact(image,
"pixel:compliance");
2423 if (value != (
char *) NULL)
2425 ComplianceType compliance=(ComplianceType) ParseCommandOption(
2426 MagickComplianceOptions,MagickFalse,value);
2427 (void) QueryMagickColorname(image,&pixel,compliance,name,
2430 (void) SetImageProperty((
Image *) image,property,name);
2439 if (LocaleNCompare(
"xmp:",property,4) == 0)
2441 (void) GetXMPProperty(image,property);
2449 if (image->properties != (
void *) NULL)
2452 image->properties,property);
2455 return((
const char *) NULL);
2544 static const char *GetMagickPropertyLetter(
const ImageInfo *image_info,
2545 Image *image,
const char letter)
2547 #define WarnNoImageInfoReturn(format,arg) \
2548 if (image_info == (ImageInfo *) NULL ) { \
2549 (void) ThrowMagickException(&image->exception,GetMagickModule(), \
2550 OptionWarning,"NoImageInfoForProperty",format,arg); \
2551 return((const char *) NULL); \
2555 value[MaxTextExtent];
2560 assert(image != (
Image *) NULL);
2561 assert(image->signature == MagickCoreSignature);
2562 if (IsEventLogging() != MagickFalse)
2563 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2565 string=(
char *) NULL;
2573 (void) FormatMagickSize(image->extent,MagickFalse,value);
2574 if (image->extent == 0)
2575 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
2583 string=GetImageProperty(image,
"comment");
2584 if (
string == (
const char *) NULL)
2593 GetPathComponent(image->magick_filename,HeadPath,value);
2603 GetPathComponent(image->magick_filename,ExtensionPath,value);
2613 GetPathComponent(image->magick_filename,TailPath,value);
2623 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
2624 (
double) image->page.width,(double) image->page.height,
2625 (
double) image->page.x,(double) image->page.y);
2633 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2634 (image->rows != 0 ? image->rows : image->magick_rows));
2642 string=image->filename;
2650 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2651 GetNumberColors(image,(FILE *) NULL,&image->exception));
2659 string=GetImageProperty(image,
"label");
2660 if (
string == (
const char *) NULL)
2669 string=image->magick;
2677 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2678 GetImageListLength(image));
2686 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2687 string=image_info->filename;
2695 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2696 GetImageIndexInList(image));
2704 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2705 MAGICKCORE_QUANTUM_DEPTH);
2716 colorspace=image->colorspace;
2717 if ((image->columns != 0) && (image->rows != 0) &&
2718 (SetImageGray(image,&image->exception) != MagickFalse))
2719 colorspace=GRAYColorspace;
2720 (void) FormatLocaleString(value,MaxTextExtent,
"%s %s %s",
2721 CommandOptionToMnemonic(MagickClassOptions,(ssize_t)
2722 image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions,
2723 (ssize_t) colorspace),image->matte != MagickFalse ?
"Matte" :
"" );
2731 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2732 if (image_info->number_scenes != 0)
2733 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2736 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2745 GetPathComponent(image->magick_filename,BasePath,value);
2755 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2756 string=image_info->unique;
2764 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2765 (image->columns != 0 ? image->columns : image->magick_columns));
2773 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2774 fabs(image->x_resolution) > MagickEpsilon ? image->x_resolution :
2775 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2784 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2785 fabs(image->y_resolution) > MagickEpsilon ? image->y_resolution :
2786 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2795 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2804 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2805 CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte));
2813 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2815 if (image->extent == 0)
2816 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2817 GetBlobSize(image));
2825 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2826 CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
2827 image->compression));
2835 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2836 CommandOptionToMnemonic(MagickDisposeOptions,(ssize_t) image->dispose));
2849 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "
2850 "$-_.+!*'(),{}|\\^~[]`\"><#%;/?:@&=";
2855 (void) CopyMagickString(value,image->magick_filename,MaxTextExtent);
2857 q=value+strlen(value);
2858 for (p+=strspn(p,allowlist); p != q; p+=strspn(p,allowlist))
2867 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2868 image->magick_columns,(double) image->magick_rows);
2876 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2877 image->page.height);
2885 string=image->magick_filename;
2890 if ((image != (
Image *) NULL) && (image->next == (
Image *) NULL))
2891 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g\n",(
double)
2892 GetImageListLength(image));
2902 (void) FormatLocaleString(value,MaxTextExtent,
"%+ld%+ld",(
long)
2903 image->page.x,(long) image->page.y);
2911 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2912 image->page.width,(double) image->page.height);
2920 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2921 (image->quality == 0 ? 92 : image->quality));
2929 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2930 if (image_info->number_scenes == 0)
2931 string=
"2147483647";
2933 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2934 image_info->scene+image_info->number_scenes);
2942 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2951 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2952 CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
2961 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2970 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
2979 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
2988 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2989 string=image_info->zero;
3000 page=GetImageBoundingBox(image,&image->exception);
3001 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
3002 (
double) page.width,(double) page.height,(
double) page.x,(double)
3011 if ((image->columns != 0) && (image->rows != 0))
3012 (void) SignatureImage(image);
3013 string=GetImageProperty(image,
"signature");
3027 if (
string != (
char *) NULL)
3029 (void) SetImageArtifact(image,
"get-property",
string);
3030 return(GetImageArtifact(image,
"get-property"));
3032 return((
char *) NULL);
3035 MagickExport
const char *GetMagickProperty(
const ImageInfo *image_info,
3036 Image *image,
const char *property)
3039 value[MaxTextExtent];
3044 assert(property[0] !=
'\0');
3045 if (property[1] ==
'\0')
3046 return(GetMagickPropertyLetter(image_info,image,*property));
3048 string=(
char *) NULL;
3053 if ((LocaleCompare(
"base",property) == 0) ||
3054 (LocaleCompare(
"basename",property) == 0) )
3056 GetPathComponent(image->magick_filename,BasePath,value);
3059 if (LocaleCompare(
"bit-depth",property) == 0)
3061 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3062 GetImageDepth(image,&image->exception));
3065 if (LocaleCompare(
"bounding-box",property) == 0)
3070 geometry=GetImageBoundingBox(image,&image->exception);
3071 (void) FormatLocaleString(value,MagickPathExtent,
"%g,%g %g,%g\n",
3072 (
double) geometry.x,(double) geometry.y,
3073 (
double) geometry.x+geometry.width,
3074 (double) geometry.y+geometry.height);
3081 if (LocaleCompare(
"channels",property) == 0)
3086 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
3087 CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3088 image->colorspace));
3090 if (image->matte != MagickFalse)
3091 (void) ConcatenateMagickString(value,
"a",MaxTextExtent);
3094 if (LocaleCompare(
"colors",property) == 0)
3096 image->colors=GetNumberColors(image,(FILE *) NULL,&image->exception);
3097 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3101 if (LocaleCompare(
"colorspace",property) == 0)
3103 string=CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3107 if (LocaleCompare(
"compose",property) == 0)
3109 string=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t)
3113 if (LocaleCompare(
"compression",property) == 0)
3115 string=CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
3116 image->compression);
3119 if (LocaleCompare(
"copyright",property) == 0)
3121 (void) CopyMagickString(value,GetMagickCopyright(),MaxTextExtent);
3128 if (LocaleCompare(
"depth",property) == 0)
3130 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3134 if (LocaleCompare(
"directory",property) == 0)
3136 GetPathComponent(image->magick_filename,HeadPath,value);
3143 if (LocaleCompare(
"entropy",property) == 0)
3148 (void) GetImageChannelEntropy(image,image_info->channel,&entropy,
3150 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3151 GetMagickPrecision(),entropy);
3154 if (LocaleCompare(
"extension",property) == 0)
3156 GetPathComponent(image->magick_filename,ExtensionPath,value);
3163 if (LocaleCompare(
"gamma",property) == 0)
3165 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3166 GetMagickPrecision(),image->gamma);
3169 if ((image_info != (
ImageInfo *) NULL) &&
3170 (LocaleCompare(
"group",property) == 0))
3172 (void) FormatLocaleString(value,MaxTextExtent,
"0x%lx",(
unsigned long)
3180 if (LocaleCompare(
"height",property) == 0)
3182 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3183 image->magick_rows != 0 ? (
double) image->magick_rows : 256.0);
3190 if (LocaleCompare(
"input",property) == 0)
3192 string=image->filename;
3195 if (LocaleCompare(
"interlace",property) == 0)
3197 string=CommandOptionToMnemonic(MagickInterlaceOptions,(ssize_t)
3205 if (LocaleCompare(
"kurtosis",property) == 0)
3211 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3212 &skewness,&image->exception);
3213 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3214 GetMagickPrecision(),kurtosis);
3221 if (LocaleCompare(
"magick",property) == 0)
3223 string=image->magick;
3226 if ((LocaleCompare(
"max",property) == 0) ||
3227 (LocaleCompare(
"maxima",property) == 0))
3233 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3234 &maximum,&image->exception);
3235 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3236 GetMagickPrecision(),maximum);
3239 if (LocaleCompare(
"mean",property) == 0)
3245 (void) GetImageChannelMean(image,image_info->channel,&mean,
3246 &standard_deviation,&image->exception);
3247 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3248 GetMagickPrecision(),mean);
3251 if ((LocaleCompare(
"min",property) == 0) ||
3252 (LocaleCompare(
"minima",property) == 0))
3258 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3259 &maximum,&image->exception);
3260 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3261 GetMagickPrecision(),minimum);
3268 if (LocaleCompare(
"opaque",property) == 0)
3273 opaque=IsOpaqueImage(image,&image->exception);
3274 (void) CopyMagickString(value,opaque != MagickFalse ?
"true" :
3275 "false",MaxTextExtent);
3278 if (LocaleCompare(
"orientation",property) == 0)
3280 string=CommandOptionToMnemonic(MagickOrientationOptions,(ssize_t)
3281 image->orientation);
3284 if ((image_info != (
ImageInfo *) NULL) &&
3285 (LocaleCompare(
"output",property) == 0))
3287 (void) CopyMagickString(value,image_info->filename,MaxTextExtent);
3294 if (LocaleCompare(
"page",property) == 0)
3296 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
3297 image->page.width,(double) image->page.height);
3300 if (LocaleNCompare(
"papersize:",property,10) == 0)
3306 papersize=GetPageGeometry(property+10);
3307 if (papersize != (
const char *) NULL)
3310 page = { 0, 0, 0, 0 };
3312 (void) ParseAbsoluteGeometry(papersize,&page);
3313 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",
3314 (
double) page.width,(double) page.height);
3315 papersize=DestroyString(papersize);
3319 #if defined(MAGICKCORE_LCMS_DELEGATE)
3320 if (LocaleCompare(
"profile:icc",property) == 0 ||
3321 LocaleCompare(
"profile:icm",property) == 0)
3323 #if !defined(LCMS_VERSION) || (LCMS_VERSION < 2000)
3324 #define cmsUInt32Number DWORD
3333 profile=GetImageProfile(image,property+8);
3337 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
3338 (cmsUInt32Number) GetStringInfoLength(profile));
3339 if (icc_profile != (cmsHPROFILE *) NULL)
3341 #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
3342 string=cmsTakeProductName(icc_profile);
3344 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
3345 "en",
"US",value,MaxTextExtent);
3347 (void) cmsCloseProfile(icc_profile);
3351 if (LocaleCompare(
"printsize.x",property) == 0)
3353 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3354 GetMagickPrecision(),PerceptibleReciprocal(image->x_resolution)*
3358 if (LocaleCompare(
"printsize.y",property) == 0)
3360 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3361 GetMagickPrecision(),PerceptibleReciprocal(image->y_resolution)*
3365 if (LocaleCompare(
"profiles",property) == 0)
3370 ResetImageProfileIterator(image);
3371 name=GetNextImageProfile(image);
3372 if (name != (
char *) NULL)
3374 (void) CopyMagickString(value,name,MaxTextExtent);
3375 name=GetNextImageProfile(image);
3376 while (name != (
char *) NULL)
3378 ConcatenateMagickString(value,
",",MaxTextExtent);
3379 ConcatenateMagickString(value,name,MaxTextExtent);
3380 name=GetNextImageProfile(image);
3389 if (LocaleCompare(
"quality",property) == 0)
3391 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3399 if (LocaleCompare(
"rendering-intent",property) == 0)
3401 string=CommandOptionToMnemonic(MagickIntentOptions,(ssize_t)
3402 image->rendering_intent);
3405 if (LocaleCompare(
"resolution.x",property) == 0)
3407 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3408 image->x_resolution);
3411 if (LocaleCompare(
"resolution.y",property) == 0)
3413 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3414 image->y_resolution);
3421 if (LocaleCompare(
"scene",property) == 0)
3423 if ((image_info != (
ImageInfo *) NULL) &&
3424 (image_info->number_scenes != 0))
3425 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3428 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3432 if (LocaleCompare(
"scenes",property) == 0)
3434 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3435 GetImageListLength(image));
3438 if (LocaleCompare(
"size",property) == 0)
3440 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
3443 if (LocaleCompare(
"skewness",property) == 0)
3449 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3450 &skewness,&image->exception);
3451 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3452 GetMagickPrecision(),skewness);
3455 if ((LocaleCompare(
"standard-deviation",property) == 0) ||
3456 (LocaleCompare(
"standard_deviation",property) == 0))
3462 (void) GetImageChannelMean(image,image_info->channel,&mean,
3463 &standard_deviation,&image->exception);
3464 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3465 GetMagickPrecision(),standard_deviation);
3472 if (LocaleCompare(
"type",property) == 0)
3474 string=CommandOptionToMnemonic(MagickTypeOptions,(ssize_t)
3475 IdentifyImageType(image,&image->exception));
3482 if ((image_info != (
ImageInfo *) NULL) &&
3483 (LocaleCompare(
"unique",property) == 0))
3485 string=image_info->unique;
3488 if (LocaleCompare(
"units",property) == 0)
3493 string=CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
3501 if (LocaleCompare(
"version",property) == 0)
3503 string=GetMagickVersion((
size_t *) NULL);
3510 if (LocaleCompare(
"width",property) == 0)
3512 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3513 (image->magick_columns != 0 ? image->magick_columns : 256));
3520 if ((LocaleCompare(
"xresolution",property) == 0) ||
3521 (LocaleCompare(
"x-resolution",property) == 0) )
3523 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3524 image->x_resolution);
3531 if ((LocaleCompare(
"yresolution",property) == 0) ||
3532 (LocaleCompare(
"y-resolution",property) == 0) )
3534 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3535 image->y_resolution);
3542 if ((image_info != (
ImageInfo *) NULL) &&
3543 (LocaleCompare(
"zero",property) == 0))
3545 string=image_info->zero;
3553 if (
string != (
char *) NULL)
3555 (void) SetImageArtifact(image,
"get-property",
string);
3556 return(GetImageArtifact(image,
"get-property"));
3558 return((
char *) NULL);
3583 MagickExport
char *GetNextImageProperty(
const Image *image)
3585 assert(image != (
Image *) NULL);
3586 assert(image->signature == MagickCoreSignature);
3587 if (IsEventLogging() != MagickFalse)
3588 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
3590 if (image->properties == (
void *) NULL)
3591 return((
char *) NULL);
3592 return((
char *) GetNextKeyInSplayTree((
SplayTreeInfo *) image->properties));
3647 MagickExport
char *InterpretImageProperties(
const ImageInfo *image_info,
3648 Image *image,
const char *embed_text)
3650 #define ExtendInterpretText(string_length) \
3652 size_t length=(string_length); \
3653 if ((size_t) (q-interpret_text+length+1) >= extent) \
3656 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3657 MaxTextExtent,sizeof(*interpret_text)); \
3658 if (interpret_text == (char *) NULL) \
3660 if (property_info != image_info) \
3661 property_info=DestroyImageInfo(property_info); \
3662 return((char *) NULL); \
3664 q=interpret_text+strlen(interpret_text); \
3668 #define AppendKeyValue2Text(key,value)\
3670 size_t length=strlen(key)+strlen(value)+2; \
3671 if ((size_t) (q-interpret_text+length+1) >= extent) \
3674 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3675 MaxTextExtent,sizeof(*interpret_text)); \
3676 if (interpret_text == (char *) NULL) \
3678 if (property_info != image_info) \
3679 property_info=DestroyImageInfo(property_info); \
3680 return((char *) NULL); \
3682 q=interpret_text+strlen(interpret_text); \
3684 q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(value)); \
3687 #define AppendString2Text(string) \
3689 size_t length=strlen((string)); \
3690 if ((size_t) (q-interpret_text+length+1) >= extent) \
3693 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3694 MaxTextExtent,sizeof(*interpret_text)); \
3695 if (interpret_text == (char *) NULL) \
3697 if (property_info != image_info) \
3698 property_info=DestroyImageInfo(property_info); \
3699 return((char *) NULL); \
3701 q=interpret_text+strlen(interpret_text); \
3703 (void) CopyMagickString(q,(string),extent); \
3725 assert(image != (
Image *) NULL);
3726 assert(image->signature == MagickCoreSignature);
3727 if (IsEventLogging() != MagickFalse)
3728 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
3729 if (embed_text == (
const char *) NULL)
3730 return(ConstantString(
""));
3732 while ((isspace((
int) ((
unsigned char) *p)) != 0) && (*p !=
'\0'))
3735 return(ConstantString(
""));
3736 if ((*p ==
'@') && (IsPathAccessible(p+1) != MagickFalse))
3741 if (IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,p) == MagickFalse)
3744 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3745 PolicyError,
"NotAuthorized",
"`%s'",p);
3746 return(ConstantString(
""));
3748 interpret_text=FileToString(p+1,~0UL,&image->exception);
3749 if (interpret_text != (
char *) NULL)
3750 return(interpret_text);
3758 property_info=CloneImageInfo(image_info);
3759 interpret_text=AcquireString(embed_text);
3760 extent=MaxTextExtent;
3762 for (q=interpret_text; *p!=
'\0';
3763 number=(isdigit((
int) ((
unsigned char) *p))) ? MagickTrue : MagickFalse,p++)
3769 ExtendInterpretText(MaxTextExtent);
3812 if (LocaleNCompare(
"<",p,4) == 0)
3818 if (LocaleNCompare(
">",p,4) == 0)
3824 if (LocaleNCompare(
"&",p,5) == 0)
3845 if ((*p ==
'\0') || (*p ==
'\'') || (*p ==
'"'))
3861 if (number != MagickFalse)
3867 value=GetMagickPropertyLetter(property_info,image,*p);
3868 if (value != (
char *) NULL)
3870 AppendString2Text(value);
3873 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3874 OptionWarning,
"UnknownImageProperty",
"\"%%%c\"",*p);
3879 pattern[2*MaxTextExtent];
3898 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3899 OptionWarning,
"UnknownImageProperty",
"\"%%[]\"");
3902 for (len=0; len<(MaxTextExtent-1L) && (*p !=
'\0');)
3904 if ((*p ==
'\\') && (*(p+1) !=
'\0'))
3909 pattern[len++]=(*p++);
3910 pattern[len++]=(*p++);
3919 pattern[len++]=(*p++);
3934 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3935 OptionError,
"UnbalancedBraces",
"\"%%[%s\"",pattern);
3936 interpret_text=DestroyString(interpret_text);
3937 if (property_info != image_info)
3938 property_info=DestroyImageInfo(property_info);
3939 return((
char *) NULL);
3944 if (LocaleNCompare(
"fx:",pattern,3) == 0)
3958 fx_info=AcquireFxInfo(image,pattern+3);
3959 status=FxEvaluateChannelExpression(fx_info,property_info->channel,0,0,
3960 &value,&image->exception);
3961 fx_info=DestroyFxInfo(fx_info);
3962 if (status != MagickFalse)
3965 result[MagickPathExtent];
3967 (void) FormatLocaleString(result,MagickPathExtent,
"%.*g",
3968 GetMagickPrecision(),(double) value);
3969 AppendString2Text(result);
3973 if (LocaleNCompare(
"option:",pattern,7) == 0)
3978 if (IsGlob(pattern+7) != MagickFalse)
3980 ResetImageOptionIterator(property_info);
3981 while ((key=GetNextImageOption(property_info)) != (
const char *) NULL)
3982 if (GlobExpression(key,pattern+7,MagickTrue) != MagickFalse)
3984 value=GetImageOption(property_info,key);
3985 if (value != (
const char *) NULL)
3986 AppendKeyValue2Text(key,value);
3991 value=GetImageOption(property_info,pattern+7);
3992 if (value != (
char *) NULL)
3993 AppendString2Text(value);
3997 if (LocaleNCompare(
"artifact:",pattern,9) == 0)
4002 if (IsGlob(pattern+9) != MagickFalse)
4004 ResetImageArtifactIterator(image);
4005 while ((key=GetNextImageArtifact(image)) != (
const char *) NULL)
4006 if (GlobExpression(key,pattern+9,MagickTrue) != MagickFalse)
4008 value=GetImageArtifact(image,key);
4009 if (value != (
const char *) NULL)
4010 AppendKeyValue2Text(key,value);
4015 value=GetImageArtifact(image,pattern+9);
4016 if (value != (
char *) NULL)
4017 AppendString2Text(value);
4027 value=GetImageProperty(image,pattern);
4028 if (value != (
const char *) NULL)
4030 AppendString2Text(value);
4037 if (IsGlob(pattern) != MagickFalse)
4039 ResetImagePropertyIterator(image);
4040 while ((key=GetNextImageProperty(image)) != (
const char *) NULL)
4041 if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
4043 value=GetImageProperty(image,key);
4044 if (value != (
const char *) NULL)
4045 AppendKeyValue2Text(key,value);
4055 value=GetMagickProperty(property_info,image,pattern);
4056 if (value != (
const char *) NULL)
4058 AppendString2Text(value);
4064 value=GetImageArtifact(image,pattern);
4065 if (value != (
char *) NULL)
4067 AppendString2Text(value);
4073 value=GetImageOption(property_info,pattern);
4074 if (value != (
char *) NULL)
4076 AppendString2Text(value);
4089 (void) ThrowMagickException(&image->exception,GetMagickModule(),
4090 OptionWarning,
"UnknownImageProperty",
"\"%%[%s]\"",pattern);
4095 if (property_info != image_info)
4096 property_info=DestroyImageInfo(property_info);
4097 return(interpret_text);
4128 MagickExport
char *RemoveImageProperty(
Image *image,
const char *property)
4133 assert(image != (
Image *) NULL);
4134 assert(image->signature == MagickCoreSignature);
4135 if (IsEventLogging() != MagickFalse)
4136 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4138 if (image->properties == (
void *) NULL)
4139 return((
char *) NULL);
4140 value=(
char *) RemoveNodeFromSplayTree((
SplayTreeInfo *) image->properties,
4169 MagickExport
void ResetImagePropertyIterator(
const Image *image)
4171 assert(image != (
Image *) NULL);
4172 assert(image->signature == MagickCoreSignature);
4173 if (IsEventLogging() != MagickFalse)
4174 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4176 if (image->properties == (
void *) NULL)
4178 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
4209 MagickExport MagickBooleanType SetImageProperty(
Image *image,
4210 const char *property,
const char *value)
4225 assert(image != (
Image *) NULL);
4226 assert(image->signature == MagickCoreSignature);
4227 if (IsEventLogging() != MagickFalse)
4228 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4230 if (image->properties == (
void *) NULL)
4231 image->properties=NewSplayTree(CompareSplayTreeString,
4232 RelinquishMagickMemory,RelinquishMagickMemory);
4233 if (value == (
const char *) NULL)
4234 return(DeleteImageProperty(image,property));
4235 exception=(&image->exception);
4236 property_length=strlen(property);
4237 if ((property_length > 2) && (*(property+(property_length-2)) ==
':') &&
4238 (*(property+(property_length-1)) ==
'*'))
4240 (void) ThrowMagickException(exception,GetMagickModule(),
4241 OptionWarning,
"SetReadOnlyProperty",
"`%s'",property);
4242 return(MagickFalse);
4257 if (LocaleCompare(
"background",property) == 0)
4259 (void) QueryColorDatabase(value,&image->background_color,exception);
4262 if (LocaleCompare(
"bias",property) == 0)
4264 image->bias=StringToDoubleInterval(value,(
double) QuantumRange+1.0);
4267 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4268 ConstantString(property),ConstantString(value));
4274 if (LocaleCompare(
"colorspace",property) == 0)
4279 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
4283 status=SetImageColorspace(image,(ColorspaceType) colorspace);
4286 if (LocaleCompare(
"compose",property) == 0)
4291 compose=ParseCommandOption(MagickComposeOptions,MagickFalse,value);
4294 image->compose=(CompositeOperator) compose;
4297 if (LocaleCompare(
"compress",property) == 0)
4302 compression=ParseCommandOption(MagickCompressOptions,MagickFalse,
4304 if (compression < 0)
4306 image->compression=(CompressionType) compression;
4309 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4310 ConstantString(property),ConstantString(value));
4316 if (LocaleCompare(
"delay",property) == 0)
4321 flags=ParseGeometry(value,&geometry_info);
4322 if ((flags & GreaterValue) != 0)
4324 if (image->delay > (
size_t) floor(geometry_info.rho+0.5))
4325 image->delay=(size_t) floor(geometry_info.rho+0.5);
4328 if ((flags & LessValue) != 0)
4330 if ((
double) image->delay < floor(geometry_info.rho+0.5))
4331 image->ticks_per_second=CastDoubleToLong(
4332 floor(geometry_info.sigma+0.5));
4335 image->delay=(size_t) floor(geometry_info.rho+0.5);
4336 if ((flags & SigmaValue) != 0)
4337 image->ticks_per_second=CastDoubleToLong(floor(
4338 geometry_info.sigma+0.5));
4341 if (LocaleCompare(
"density",property) == 0)
4346 flags=ParseGeometry(value,&geometry_info);
4347 if ((flags & RhoValue) != 0)
4348 image->x_resolution=geometry_info.rho;
4349 image->y_resolution=image->x_resolution;
4350 if ((flags & SigmaValue) != 0)
4351 image->y_resolution=geometry_info.sigma;
4353 if (LocaleCompare(
"depth",property) == 0)
4355 image->depth=StringToUnsignedLong(value);
4358 if (LocaleCompare(
"dispose",property) == 0)
4363 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,value);
4366 image->dispose=(DisposeType) dispose;
4369 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4370 ConstantString(property),ConstantString(value));
4376 if (LocaleCompare(
"gamma",property) == 0)
4378 image->gamma=StringToDouble(value,(
char **) NULL);
4381 if (LocaleCompare(
"gravity",property) == 0)
4386 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value);
4389 image->gravity=(GravityType) gravity;
4392 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4393 ConstantString(property),ConstantString(value));
4399 if (LocaleCompare(
"intensity",property) == 0)
4404 intensity=ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
4408 image->intensity=(PixelIntensityMethod) intensity;
4411 if (LocaleCompare(
"interpolate",property) == 0)
4416 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
4418 if (interpolate < 0)
4420 image->interpolate=(InterpolatePixelMethod) interpolate;
4423 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4424 ConstantString(property),ConstantString(value));
4430 if (LocaleCompare(
"loop",property) == 0)
4432 image->iterations=StringToUnsignedLong(value);
4435 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4436 ConstantString(property),ConstantString(value));
4442 if (LocaleCompare(
"page",property) == 0)
4447 geometry=GetPageGeometry(value);
4448 flags=ParseAbsoluteGeometry(geometry,&image->page);
4449 geometry=DestroyString(geometry);
4452 if (LocaleCompare(
"profile",property) == 0)
4460 image_info=AcquireImageInfo();
4461 (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
4462 (void) SetImageInfo(image_info,1,exception);
4463 if (LocaleCompare(image_info->filename,
"-") != 0)
4464 profile=FileToStringInfo(image_info->filename,~0UL,exception);
4467 status=SetImageProfile(image,image_info->magick,profile);
4468 profile=DestroyStringInfo(profile);
4470 image_info=DestroyImageInfo(image_info);
4473 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4474 ConstantString(property),ConstantString(value));
4480 if (LocaleCompare(
"rendering-intent",property) == 0)
4485 rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse,
4487 if (rendering_intent < 0)
4489 image->rendering_intent=(RenderingIntent) rendering_intent;
4492 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4493 ConstantString(property),ConstantString(value));
4499 if (LocaleCompare(
"tile-offset",property) == 0)
4504 geometry=GetPageGeometry(value);
4505 flags=ParseAbsoluteGeometry(geometry,&image->tile_offset);
4506 geometry=DestroyString(geometry);
4509 if (LocaleCompare(
"type",property) == 0)
4514 type=ParseCommandOption(MagickTypeOptions,MagickFalse,value);
4516 return(MagickFalse);
4517 image->type=(ImageType) type;
4520 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4521 ConstantString(property),ConstantString(value));
4527 if (LocaleCompare(
"units",property) == 0)
4532 units=ParseCommandOption(MagickResolutionOptions,MagickFalse,value);
4535 image->units=(ResolutionType) units;
4538 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4539 ConstantString(property),ConstantString(value));
4544 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4545 ConstantString(property),ConstantString(value));