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"
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)
99#if defined(MAGICKCORE_LCMS_DELEGATE)
100#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
101#define cmsUInt32Number DWORD
132 *(*CloneKeyFunc)(
const char *),
133 *(*CloneValueFunc)(
const char *);
135static inline void *ClonePropertyKey(
void *key)
137 return((
void *) ((CloneKeyFunc) ConstantString)((
const char *) key));
140static inline void *ClonePropertyValue(
void *value)
142 return((
void *) ((CloneValueFunc) ConstantString)((
const char *) value));
145MagickExport MagickBooleanType CloneImageProperties(
Image *image,
146 const Image *clone_image)
148 assert(image != (
Image *) NULL);
149 assert(image->signature == MagickCoreSignature);
150 assert(clone_image != (
const Image *) NULL);
151 assert(clone_image->signature == MagickCoreSignature);
152 if (IsEventLogging() != MagickFalse)
154 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
155 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
156 clone_image->filename);
158 (void) CopyMagickString(image->filename,clone_image->filename,MaxTextExtent);
159 (void) CopyMagickString(image->magick_filename,clone_image->magick_filename,
161 image->compression=clone_image->compression;
162 image->quality=clone_image->quality;
163 image->depth=clone_image->depth;
164 image->background_color=clone_image->background_color;
165 image->border_color=clone_image->border_color;
166 image->matte_color=clone_image->matte_color;
167 image->transparent_color=clone_image->transparent_color;
168 image->gamma=clone_image->gamma;
169 image->chromaticity=clone_image->chromaticity;
170 image->rendering_intent=clone_image->rendering_intent;
171 image->black_point_compensation=clone_image->black_point_compensation;
172 image->units=clone_image->units;
173 image->montage=(
char *) NULL;
174 image->directory=(
char *) NULL;
175 (void) CloneString(&image->geometry,clone_image->geometry);
176 image->offset=clone_image->offset;
177 image->x_resolution=clone_image->x_resolution;
178 image->y_resolution=clone_image->y_resolution;
179 image->page=clone_image->page;
180 image->tile_offset=clone_image->tile_offset;
181 image->extract_info=clone_image->extract_info;
182 image->bias=clone_image->bias;
183 image->filter=clone_image->filter;
184 image->blur=clone_image->blur;
185 image->fuzz=clone_image->fuzz;
186 image->intensity=clone_image->intensity;
187 image->interlace=clone_image->interlace;
188 image->interpolate=clone_image->interpolate;
189 image->endian=clone_image->endian;
190 image->gravity=clone_image->gravity;
191 image->compose=clone_image->compose;
192 image->orientation=clone_image->orientation;
193 image->scene=clone_image->scene;
194 image->dispose=clone_image->dispose;
195 image->delay=clone_image->delay;
196 image->ticks_per_second=clone_image->ticks_per_second;
197 image->iterations=clone_image->iterations;
198 image->total_colors=clone_image->total_colors;
199 image->taint=clone_image->taint;
200 image->progress_monitor=clone_image->progress_monitor;
201 image->client_data=clone_image->client_data;
202 image->start_loop=clone_image->start_loop;
203 image->error=clone_image->error;
204 image->signature=clone_image->signature;
205 if (clone_image->properties != (
void *) NULL)
207 if (image->properties != (
void *) NULL)
208 DestroyImageProperties(image);
210 clone_image->properties,ClonePropertyKey,ClonePropertyValue);
242MagickExport MagickBooleanType DefineImageProperty(
Image *image,
243 const char *property)
247 value[MaxTextExtent];
252 assert(image != (
Image *) NULL);
253 assert(property != (
const char *) NULL);
254 (void) CopyMagickString(key,property,MaxTextExtent-1);
255 for (p=key; *p !=
'\0'; p++)
260 (void) CopyMagickString(value,p+1,MaxTextExtent);
262 return(SetImageProperty(image,key,value));
289MagickExport MagickBooleanType DeleteImageProperty(
Image *image,
290 const char *property)
292 assert(image != (
Image *) NULL);
293 assert(image->signature == MagickCoreSignature);
294 if (IsEventLogging() != MagickFalse)
295 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
296 if (image->properties == (
void *) NULL)
298 return(DeleteNodeFromSplayTree((
SplayTreeInfo *) image->properties,property));
324MagickExport
void DestroyImageProperties(
Image *image)
326 assert(image != (
Image *) NULL);
327 assert(image->signature == MagickCoreSignature);
328 if (IsEventLogging() != MagickFalse)
329 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
330 if (image->properties != (
void *) NULL)
331 image->properties=(
void *) DestroySplayTree((
SplayTreeInfo *)
364MagickExport MagickBooleanType FormatImageProperty(
Image *image,
365 const char *property,
const char *format,...)
368 value[MaxTextExtent];
376 va_start(operands,format);
377 n=FormatLocaleStringList(value,MaxTextExtent,format,operands);
380 return(SetImageProperty(image,property,value));
416 *TracePSClippath(
const unsigned char *,
size_t,
const size_t,
418 *TraceSVGClippath(
const unsigned char *,
size_t,
const size_t,
421static MagickBooleanType GetIPTCProperty(
const Image *image,
const char *key)
441 profile=GetImageProfile(image,
"iptc");
443 profile=GetImageProfile(image,
"8bim");
446 count=sscanf(key,
"IPTC:%ld:%ld",&dataset,&record);
449 attribute=(
char *) NULL;
450 for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=(ssize_t) length)
453 if ((ssize_t) GetStringInfoDatum(profile)[i] != 0x1c)
455 length=(size_t) (GetStringInfoDatum(profile)[i+3] << 8);
456 length|=GetStringInfoDatum(profile)[i+4];
457 if (((
long) GetStringInfoDatum(profile)[i+1] == dataset) &&
458 ((
long) GetStringInfoDatum(profile)[i+2] == record))
460 message=(
char *) NULL;
462 message=(
char *) AcquireQuantumMemory(length+1UL,
sizeof(*message));
463 if (message != (
char *) NULL)
465 (void) CopyMagickString(message,(
char *) GetStringInfoDatum(
466 profile)+i+5,length+1);
467 (void) ConcatenateString(&attribute,message);
468 (void) ConcatenateString(&attribute,
";");
469 message=DestroyString(message);
474 if ((attribute == (
char *) NULL) || (*attribute ==
';'))
476 if (attribute != (
char *) NULL)
477 attribute=DestroyString(attribute);
480 attribute[strlen(attribute)-1]=
'\0';
481 (void) SetImageProperty((
Image *) image,key,(
const char *) attribute);
482 attribute=DestroyString(attribute);
486static inline int ReadPropertyByte(
const unsigned char **p,
size_t *length)
498static inline signed int ReadPropertyMSBLong(
const unsigned char **p,
524 for (i=0; i < 4; i++)
528 buffer[i]=(
unsigned char) c;
530 value=(
unsigned int) buffer[0] << 24;
531 value|=(
unsigned int) buffer[1] << 16;
532 value|=(
unsigned int) buffer[2] << 8;
533 value|=(
unsigned int) buffer[3];
534 quantum.unsigned_value=value & 0xffffffff;
535 return(quantum.signed_value);
538static inline signed short ReadPropertyMSBShort(
const unsigned char **p,
563 return((
unsigned short) ~0);
564 for (i=0; i < 2; i++)
568 buffer[i]=(
unsigned char) c;
570 value=(
unsigned short) buffer[0] << 8;
571 value|=(
unsigned short) buffer[1];
572 quantum.unsigned_value=value & 0xffff;
573 return(quantum.signed_value);
576static MagickBooleanType Get8BIMProperty(
const Image *image,
const char *key)
580 format[MaxTextExtent],
611 profile=GetImageProfile(image,
"8bim");
614 count=(ssize_t) sscanf(key,
"8BIM:%ld,%ld:%1024[^\n]\n%1024[^\n]",&start,&stop,
616 if ((count != 2) && (count != 3) && (count != 4))
619 (void) CopyMagickString(format,
"SVG",MaxTextExtent);
624 sub_number=(ssize_t) StringToLong(&name[1]);
625 sub_number=MagickMax(sub_number,1L);
626 resource=(
char *) NULL;
628 length=GetStringInfoLength(profile);
629 info=GetStringInfoDatum(profile);
630 while ((length > 0) && (status == MagickFalse))
632 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'8')
634 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'B')
636 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'I')
638 if (ReadPropertyByte(&info,&length) != (
unsigned char)
'M')
640 id=(ssize_t) ReadPropertyMSBShort(&info,&length);
641 if (
id < (ssize_t) start)
643 if (
id > (ssize_t) stop)
645 if (resource != (
char *) NULL)
646 resource=DestroyString(resource);
647 count=(ssize_t) ReadPropertyByte(&info,&length);
648 if ((count != 0) && ((size_t) count <= length))
650 resource=(
char *) NULL;
651 if (~((
size_t) count) >= (MaxTextExtent-1))
652 resource=(
char *) AcquireQuantumMemory((
size_t) count+MaxTextExtent,
654 if (resource != (
char *) NULL)
656 for (i=0; i < (ssize_t) count; i++)
657 resource[i]=(
char) ReadPropertyByte(&info,&length);
658 resource[count]=
'\0';
661 if ((count & 0x01) == 0)
662 (void) ReadPropertyByte(&info,&length);
663 count=(ssize_t) ReadPropertyMSBLong(&info,&length);
664 if ((count < 0) || ((size_t) count > length))
669 if ((*name !=
'\0') && (*name !=
'#'))
670 if ((resource == (
char *) NULL) || (LocaleCompare(name,resource) != 0))
676 length-=MagickMin(count,(ssize_t) length);
679 if ((*name ==
'#') && (sub_number != 1))
686 length-=MagickMin(count,(ssize_t) length);
692 attribute=(
char *) NULL;
693 if (~((
size_t) count) >= (MaxTextExtent-1))
694 attribute=(
char *) AcquireQuantumMemory((
size_t) count+MaxTextExtent,
696 if (attribute != (
char *) NULL)
698 (void) memcpy(attribute,(
char *) info,(size_t) count);
699 attribute[count]=
'\0';
701 length-=MagickMin(count,(ssize_t) length);
702 if ((
id <= 1999) || (
id >= 2999))
703 (void) SetImageProperty((
Image *) image,key,(
const char *) attribute);
709 if (LocaleCompare(format,
"svg") == 0)
710 path=TraceSVGClippath((
unsigned char *) attribute,(size_t) count,
711 image->columns,image->rows);
713 path=TracePSClippath((
unsigned char *) attribute,(
size_t) count,
714 image->columns,image->rows);
715 (void) SetImageProperty((
Image *) image,key,(
const char *) path);
716 path=DestroyString(path);
718 attribute=DestroyString(attribute);
722 if (resource != (
char *) NULL)
723 resource=DestroyString(resource);
727static inline signed int ReadPropertySignedLong(
const EndianType endian,
728 const unsigned char *buffer)
742 if (endian == LSBEndian)
744 value=(
unsigned int) buffer[3] << 24;
745 value|=(
unsigned int) buffer[2] << 16;
746 value|=(
unsigned int) buffer[1] << 8;
747 value|=(
unsigned int) buffer[0];
748 quantum.unsigned_value=value & 0xffffffff;
749 return(quantum.signed_value);
751 value=(
unsigned int) buffer[0] << 24;
752 value|=(
unsigned int) buffer[1] << 16;
753 value|=(
unsigned int) buffer[2] << 8;
754 value|=(
unsigned int) buffer[3];
755 quantum.unsigned_value=value & 0xffffffff;
756 return(quantum.signed_value);
759static inline unsigned int ReadPropertyUnsignedLong(
const EndianType endian,
760 const unsigned char *buffer)
765 if (endian == LSBEndian)
767 value=(
unsigned int) buffer[3] << 24;
768 value|=(
unsigned int) buffer[2] << 16;
769 value|=(
unsigned int) buffer[1] << 8;
770 value|=(
unsigned int) buffer[0];
771 return(value & 0xffffffff);
773 value=(
unsigned int) buffer[0] << 24;
774 value|=(
unsigned int) buffer[1] << 16;
775 value|=(
unsigned int) buffer[2] << 8;
776 value|=(
unsigned int) buffer[3];
777 return(value & 0xffffffff);
780static inline signed short ReadPropertySignedShort(
const EndianType endian,
781 const unsigned char *buffer)
795 if (endian == LSBEndian)
797 value=(
unsigned short) buffer[1] << 8;
798 value|=(
unsigned short) buffer[0];
799 quantum.unsigned_value=value & 0xffff;
800 return(quantum.signed_value);
802 value=(
unsigned short) buffer[0] << 8;
803 value|=(
unsigned short) buffer[1];
804 quantum.unsigned_value=value & 0xffff;
805 return(quantum.signed_value);
808static inline unsigned short ReadPropertyUnsignedShort(
const EndianType endian,
809 const unsigned char *buffer)
814 if (endian == LSBEndian)
816 value=(
unsigned short) buffer[1] << 8;
817 value|=(
unsigned short) buffer[0];
818 return(value & 0xffff);
820 value=(
unsigned short) buffer[0] << 8;
821 value|=(
unsigned short) buffer[1];
822 return(value & 0xffff);
825static MagickBooleanType GetEXIFProperty(
const Image *image,
826 const char *property)
828#define MaxDirectoryStack 16
829#define EXIF_DELIMITER "\n"
830#define EXIF_NUM_FORMATS 12
831#define EXIF_FMT_BYTE 1
832#define EXIF_FMT_STRING 2
833#define EXIF_FMT_USHORT 3
834#define EXIF_FMT_ULONG 4
835#define EXIF_FMT_URATIONAL 5
836#define EXIF_FMT_SBYTE 6
837#define EXIF_FMT_UNDEFINED 7
838#define EXIF_FMT_SSHORT 8
839#define EXIF_FMT_SLONG 9
840#define EXIF_FMT_SRATIONAL 10
841#define EXIF_FMT_SINGLE 11
842#define EXIF_FMT_DOUBLE 12
843#define GPS_LATITUDE 0x10002
844#define GPS_LONGITUDE 0x10004
845#define GPS_TIMESTAMP 0x10007
846#define TAG_EXIF_OFFSET 0x8769
847#define TAG_GPS_OFFSET 0x8825
848#define TAG_INTEROP_OFFSET 0xa005
850#define EXIFGPSFractions(format,arg1,arg2,arg3,arg4,arg5,arg6) \
858 for ( ; component < components; component++) \
860 extent=(size_t) ((ssize_t) extent+FormatLocaleString(buffer+extent, \
861 MagickPathExtent-extent,format", ",(arg1),(arg2),(arg3),(arg4),(arg5), \
863 if (extent >= (MagickPathExtent-1)) \
864 extent=MagickPathExtent-1; \
867 buffer[extent-2]='\0'; \
868 value=AcquireString(buffer); \
871#define EXIFMultipleValues(format,arg) \
880 for (component=0; component < components; component++) \
882 length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
884 if (length >= (MaxTextExtent-1)) \
885 length=MaxTextExtent-1; \
888 buffer[length-2]='\0'; \
889 value=AcquireString(buffer); \
892#define EXIFMultipleFractions(format,arg1,arg2) \
901 for (component=0; component < components; component++) \
903 length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
904 format", ",(arg1),(arg2)); \
905 if (length >= (MaxTextExtent-1)) \
906 length=MaxTextExtent-1; \
909 buffer[length-2]='\0'; \
910 value=AcquireString(buffer); \
913 typedef struct _DirectoryInfo
925 typedef struct _TagInfo
937 { 0x001,
"exif:InteroperabilityIndex" },
938 { 0x002,
"exif:InteroperabilityVersion" },
939 { 0x100,
"exif:ImageWidth" },
940 { 0x101,
"exif:ImageLength" },
941 { 0x102,
"exif:BitsPerSample" },
942 { 0x103,
"exif:Compression" },
943 { 0x106,
"exif:PhotometricInterpretation" },
944 { 0x10a,
"exif:FillOrder" },
945 { 0x10d,
"exif:DocumentName" },
946 { 0x10e,
"exif:ImageDescription" },
947 { 0x10f,
"exif:Make" },
948 { 0x110,
"exif:Model" },
949 { 0x111,
"exif:StripOffsets" },
950 { 0x112,
"exif:Orientation" },
951 { 0x115,
"exif:SamplesPerPixel" },
952 { 0x116,
"exif:RowsPerStrip" },
953 { 0x117,
"exif:StripByteCounts" },
954 { 0x11a,
"exif:XResolution" },
955 { 0x11b,
"exif:YResolution" },
956 { 0x11c,
"exif:PlanarConfiguration" },
957 { 0x11d,
"exif:PageName" },
958 { 0x11e,
"exif:XPosition" },
959 { 0x11f,
"exif:YPosition" },
960 { 0x118,
"exif:MinSampleValue" },
961 { 0x119,
"exif:MaxSampleValue" },
962 { 0x120,
"exif:FreeOffsets" },
963 { 0x121,
"exif:FreeByteCounts" },
964 { 0x122,
"exif:GrayResponseUnit" },
965 { 0x123,
"exif:GrayResponseCurve" },
966 { 0x124,
"exif:T4Options" },
967 { 0x125,
"exif:T6Options" },
968 { 0x128,
"exif:ResolutionUnit" },
969 { 0x12d,
"exif:TransferFunction" },
970 { 0x131,
"exif:Software" },
971 { 0x132,
"exif:DateTime" },
972 { 0x13b,
"exif:Artist" },
973 { 0x13e,
"exif:WhitePoint" },
974 { 0x13f,
"exif:PrimaryChromaticities" },
975 { 0x140,
"exif:ColorMap" },
976 { 0x141,
"exif:HalfToneHints" },
977 { 0x142,
"exif:TileWidth" },
978 { 0x143,
"exif:TileLength" },
979 { 0x144,
"exif:TileOffsets" },
980 { 0x145,
"exif:TileByteCounts" },
981 { 0x14a,
"exif:SubIFD" },
982 { 0x14c,
"exif:InkSet" },
983 { 0x14d,
"exif:InkNames" },
984 { 0x14e,
"exif:NumberOfInks" },
985 { 0x150,
"exif:DotRange" },
986 { 0x151,
"exif:TargetPrinter" },
987 { 0x152,
"exif:ExtraSample" },
988 { 0x153,
"exif:SampleFormat" },
989 { 0x154,
"exif:SMinSampleValue" },
990 { 0x155,
"exif:SMaxSampleValue" },
991 { 0x156,
"exif:TransferRange" },
992 { 0x157,
"exif:ClipPath" },
993 { 0x158,
"exif:XClipPathUnits" },
994 { 0x159,
"exif:YClipPathUnits" },
995 { 0x15a,
"exif:Indexed" },
996 { 0x15b,
"exif:JPEGTables" },
997 { 0x15f,
"exif:OPIProxy" },
998 { 0x200,
"exif:JPEGProc" },
999 { 0x201,
"exif:JPEGInterchangeFormat" },
1000 { 0x202,
"exif:JPEGInterchangeFormatLength" },
1001 { 0x203,
"exif:JPEGRestartInterval" },
1002 { 0x205,
"exif:JPEGLosslessPredictors" },
1003 { 0x206,
"exif:JPEGPointTransforms" },
1004 { 0x207,
"exif:JPEGQTables" },
1005 { 0x208,
"exif:JPEGDCTables" },
1006 { 0x209,
"exif:JPEGACTables" },
1007 { 0x211,
"exif:YCbCrCoefficients" },
1008 { 0x212,
"exif:YCbCrSubSampling" },
1009 { 0x213,
"exif:YCbCrPositioning" },
1010 { 0x214,
"exif:ReferenceBlackWhite" },
1011 { 0x2bc,
"exif:ExtensibleMetadataPlatform" },
1012 { 0x301,
"exif:Gamma" },
1013 { 0x302,
"exif:ICCProfileDescriptor" },
1014 { 0x303,
"exif:SRGBRenderingIntent" },
1015 { 0x320,
"exif:ImageTitle" },
1016 { 0x5001,
"exif:ResolutionXUnit" },
1017 { 0x5002,
"exif:ResolutionYUnit" },
1018 { 0x5003,
"exif:ResolutionXLengthUnit" },
1019 { 0x5004,
"exif:ResolutionYLengthUnit" },
1020 { 0x5005,
"exif:PrintFlags" },
1021 { 0x5006,
"exif:PrintFlagsVersion" },
1022 { 0x5007,
"exif:PrintFlagsCrop" },
1023 { 0x5008,
"exif:PrintFlagsBleedWidth" },
1024 { 0x5009,
"exif:PrintFlagsBleedWidthScale" },
1025 { 0x500A,
"exif:HalftoneLPI" },
1026 { 0x500B,
"exif:HalftoneLPIUnit" },
1027 { 0x500C,
"exif:HalftoneDegree" },
1028 { 0x500D,
"exif:HalftoneShape" },
1029 { 0x500E,
"exif:HalftoneMisc" },
1030 { 0x500F,
"exif:HalftoneScreen" },
1031 { 0x5010,
"exif:JPEGQuality" },
1032 { 0x5011,
"exif:GridSize" },
1033 { 0x5012,
"exif:ThumbnailFormat" },
1034 { 0x5013,
"exif:ThumbnailWidth" },
1035 { 0x5014,
"exif:ThumbnailHeight" },
1036 { 0x5015,
"exif:ThumbnailColorDepth" },
1037 { 0x5016,
"exif:ThumbnailPlanes" },
1038 { 0x5017,
"exif:ThumbnailRawBytes" },
1039 { 0x5018,
"exif:ThumbnailSize" },
1040 { 0x5019,
"exif:ThumbnailCompressedSize" },
1041 { 0x501a,
"exif:ColorTransferFunction" },
1042 { 0x501b,
"exif:ThumbnailData" },
1043 { 0x5020,
"exif:ThumbnailImageWidth" },
1044 { 0x5021,
"exif:ThumbnailImageHeight" },
1045 { 0x5022,
"exif:ThumbnailBitsPerSample" },
1046 { 0x5023,
"exif:ThumbnailCompression" },
1047 { 0x5024,
"exif:ThumbnailPhotometricInterp" },
1048 { 0x5025,
"exif:ThumbnailImageDescription" },
1049 { 0x5026,
"exif:ThumbnailEquipMake" },
1050 { 0x5027,
"exif:ThumbnailEquipModel" },
1051 { 0x5028,
"exif:ThumbnailStripOffsets" },
1052 { 0x5029,
"exif:ThumbnailOrientation" },
1053 { 0x502a,
"exif:ThumbnailSamplesPerPixel" },
1054 { 0x502b,
"exif:ThumbnailRowsPerStrip" },
1055 { 0x502c,
"exif:ThumbnailStripBytesCount" },
1056 { 0x502d,
"exif:ThumbnailResolutionX" },
1057 { 0x502e,
"exif:ThumbnailResolutionY" },
1058 { 0x502f,
"exif:ThumbnailPlanarConfig" },
1059 { 0x5030,
"exif:ThumbnailResolutionUnit" },
1060 { 0x5031,
"exif:ThumbnailTransferFunction" },
1061 { 0x5032,
"exif:ThumbnailSoftwareUsed" },
1062 { 0x5033,
"exif:ThumbnailDateTime" },
1063 { 0x5034,
"exif:ThumbnailArtist" },
1064 { 0x5035,
"exif:ThumbnailWhitePoint" },
1065 { 0x5036,
"exif:ThumbnailPrimaryChromaticities" },
1066 { 0x5037,
"exif:ThumbnailYCbCrCoefficients" },
1067 { 0x5038,
"exif:ThumbnailYCbCrSubsampling" },
1068 { 0x5039,
"exif:ThumbnailYCbCrPositioning" },
1069 { 0x503A,
"exif:ThumbnailRefBlackWhite" },
1070 { 0x503B,
"exif:ThumbnailCopyRight" },
1071 { 0x5090,
"exif:LuminanceTable" },
1072 { 0x5091,
"exif:ChrominanceTable" },
1073 { 0x5100,
"exif:FrameDelay" },
1074 { 0x5101,
"exif:LoopCount" },
1075 { 0x5110,
"exif:PixelUnit" },
1076 { 0x5111,
"exif:PixelPerUnitX" },
1077 { 0x5112,
"exif:PixelPerUnitY" },
1078 { 0x5113,
"exif:PaletteHistogram" },
1079 { 0x1000,
"exif:RelatedImageFileFormat" },
1080 { 0x1001,
"exif:RelatedImageLength" },
1081 { 0x1002,
"exif:RelatedImageWidth" },
1082 { 0x800d,
"exif:ImageID" },
1083 { 0x80e3,
"exif:Matteing" },
1084 { 0x80e4,
"exif:DataType" },
1085 { 0x80e5,
"exif:ImageDepth" },
1086 { 0x80e6,
"exif:TileDepth" },
1087 { 0x828d,
"exif:CFARepeatPatternDim" },
1088 { 0x828e,
"exif:CFAPattern2" },
1089 { 0x828f,
"exif:BatteryLevel" },
1090 { 0x8298,
"exif:Copyright" },
1091 { 0x829a,
"exif:ExposureTime" },
1092 { 0x829d,
"exif:FNumber" },
1093 { 0x83bb,
"exif:IPTC/NAA" },
1094 { 0x84e3,
"exif:IT8RasterPadding" },
1095 { 0x84e5,
"exif:IT8ColorTable" },
1096 { 0x8649,
"exif:ImageResourceInformation" },
1097 { 0x8769,
"exif:ExifOffset" },
1098 { 0x8773,
"exif:InterColorProfile" },
1099 { 0x8822,
"exif:ExposureProgram" },
1100 { 0x8824,
"exif:SpectralSensitivity" },
1101 { 0x8825,
"exif:GPSInfo" },
1102 { 0x8827,
"exif:PhotographicSensitivity" },
1103 { 0x8828,
"exif:OECF" },
1104 { 0x8829,
"exif:Interlace" },
1105 { 0x882a,
"exif:TimeZoneOffset" },
1106 { 0x882b,
"exif:SelfTimerMode" },
1107 { 0x8830,
"exif:SensitivityType" },
1108 { 0x8831,
"exif:StandardOutputSensitivity" },
1109 { 0x8832,
"exif:RecommendedExposureIndex" },
1110 { 0x8833,
"exif:ISOSpeed" },
1111 { 0x8834,
"exif:ISOSpeedLatitudeyyy" },
1112 { 0x8835,
"exif:ISOSpeedLatitudezzz" },
1113 { 0x9000,
"exif:ExifVersion" },
1114 { 0x9003,
"exif:DateTimeOriginal" },
1115 { 0x9004,
"exif:DateTimeDigitized" },
1116 { 0x9010,
"exif:OffsetTime" },
1117 { 0x9011,
"exif:OffsetTimeOriginal" },
1118 { 0x9012,
"exif:OffsetTimeDigitized" },
1119 { 0x9101,
"exif:ComponentsConfiguration" },
1120 { 0x9102,
"exif:CompressedBitsPerPixel" },
1121 { 0x9201,
"exif:ShutterSpeedValue" },
1122 { 0x9202,
"exif:ApertureValue" },
1123 { 0x9203,
"exif:BrightnessValue" },
1124 { 0x9204,
"exif:ExposureBiasValue" },
1125 { 0x9205,
"exif:MaxApertureValue" },
1126 { 0x9206,
"exif:SubjectDistance" },
1127 { 0x9207,
"exif:MeteringMode" },
1128 { 0x9208,
"exif:LightSource" },
1129 { 0x9209,
"exif:Flash" },
1130 { 0x920a,
"exif:FocalLength" },
1131 { 0x920b,
"exif:FlashEnergy" },
1132 { 0x920c,
"exif:SpatialFrequencyResponse" },
1133 { 0x920d,
"exif:Noise" },
1134 { 0x9214,
"exif:SubjectArea" },
1135 { 0x9290,
"exif:SubSecTime" },
1136 { 0x9291,
"exif:SubSecTimeOriginal" },
1137 { 0x9292,
"exif:SubSecTimeDigitized" },
1138 { 0x9211,
"exif:ImageNumber" },
1139 { 0x9212,
"exif:SecurityClassification" },
1140 { 0x9213,
"exif:ImageHistory" },
1141 { 0x9214,
"exif:SubjectArea" },
1142 { 0x9215,
"exif:ExposureIndex" },
1143 { 0x9216,
"exif:TIFF-EPStandardID" },
1144 { 0x927c,
"exif:MakerNote" },
1145 { 0x9286,
"exif:UserComment" },
1146 { 0x9290,
"exif:SubSecTime" },
1147 { 0x9291,
"exif:SubSecTimeOriginal" },
1148 { 0x9292,
"exif:SubSecTimeDigitized" },
1149 { 0x9400,
"exif:Temperature" },
1150 { 0x9401,
"exif:Humidity" },
1151 { 0x9402,
"exif:Pressure" },
1152 { 0x9403,
"exif:WaterDepth" },
1153 { 0x9404,
"exif:Acceleration" },
1154 { 0x9405,
"exif:CameraElevationAngle" },
1155 { 0x9C9b,
"exif:WinXP-Title" },
1156 { 0x9C9c,
"exif:WinXP-Comments" },
1157 { 0x9C9d,
"exif:WinXP-Author" },
1158 { 0x9C9e,
"exif:WinXP-Keywords" },
1159 { 0x9C9f,
"exif:WinXP-Subject" },
1160 { 0xa000,
"exif:FlashPixVersion" },
1161 { 0xa001,
"exif:ColorSpace" },
1162 { 0xa002,
"exif:PixelXDimension" },
1163 { 0xa003,
"exif:PixelYDimension" },
1164 { 0xa004,
"exif:RelatedSoundFile" },
1165 { 0xa005,
"exif:InteroperabilityOffset" },
1166 { 0xa20b,
"exif:FlashEnergy" },
1167 { 0xa20c,
"exif:SpatialFrequencyResponse" },
1168 { 0xa20d,
"exif:Noise" },
1169 { 0xa20e,
"exif:FocalPlaneXResolution" },
1170 { 0xa20f,
"exif:FocalPlaneYResolution" },
1171 { 0xa210,
"exif:FocalPlaneResolutionUnit" },
1172 { 0xa214,
"exif:SubjectLocation" },
1173 { 0xa215,
"exif:ExposureIndex" },
1174 { 0xa216,
"exif:TIFF/EPStandardID" },
1175 { 0xa217,
"exif:SensingMethod" },
1176 { 0xa300,
"exif:FileSource" },
1177 { 0xa301,
"exif:SceneType" },
1178 { 0xa302,
"exif:CFAPattern" },
1179 { 0xa401,
"exif:CustomRendered" },
1180 { 0xa402,
"exif:ExposureMode" },
1181 { 0xa403,
"exif:WhiteBalance" },
1182 { 0xa404,
"exif:DigitalZoomRatio" },
1183 { 0xa405,
"exif:FocalLengthIn35mmFilm" },
1184 { 0xa406,
"exif:SceneCaptureType" },
1185 { 0xa407,
"exif:GainControl" },
1186 { 0xa408,
"exif:Contrast" },
1187 { 0xa409,
"exif:Saturation" },
1188 { 0xa40a,
"exif:Sharpness" },
1189 { 0xa40b,
"exif:DeviceSettingDescription" },
1190 { 0xa40c,
"exif:SubjectDistanceRange" },
1191 { 0xa420,
"exif:ImageUniqueID" },
1192 { 0xa430,
"exif:CameraOwnerName" },
1193 { 0xa431,
"exif:BodySerialNumber" },
1194 { 0xa432,
"exif:LensSpecification" },
1195 { 0xa433,
"exif:LensMake" },
1196 { 0xa434,
"exif:LensModel" },
1197 { 0xa435,
"exif:LensSerialNumber" },
1198 { 0xc4a5,
"exif:PrintImageMatching" },
1199 { 0xa500,
"exif:Gamma" },
1200 { 0xc640,
"exif:CR2Slice" },
1201 { 0x10000,
"exif:GPSVersionID" },
1202 { 0x10001,
"exif:GPSLatitudeRef" },
1203 { 0x10002,
"exif:GPSLatitude" },
1204 { 0x10003,
"exif:GPSLongitudeRef" },
1205 { 0x10004,
"exif:GPSLongitude" },
1206 { 0x10005,
"exif:GPSAltitudeRef" },
1207 { 0x10006,
"exif:GPSAltitude" },
1208 { 0x10007,
"exif:GPSTimeStamp" },
1209 { 0x10008,
"exif:GPSSatellites" },
1210 { 0x10009,
"exif:GPSStatus" },
1211 { 0x1000a,
"exif:GPSMeasureMode" },
1212 { 0x1000b,
"exif:GPSDop" },
1213 { 0x1000c,
"exif:GPSSpeedRef" },
1214 { 0x1000d,
"exif:GPSSpeed" },
1215 { 0x1000e,
"exif:GPSTrackRef" },
1216 { 0x1000f,
"exif:GPSTrack" },
1217 { 0x10010,
"exif:GPSImgDirectionRef" },
1218 { 0x10011,
"exif:GPSImgDirection" },
1219 { 0x10012,
"exif:GPSMapDatum" },
1220 { 0x10013,
"exif:GPSDestLatitudeRef" },
1221 { 0x10014,
"exif:GPSDestLatitude" },
1222 { 0x10015,
"exif:GPSDestLongitudeRef" },
1223 { 0x10016,
"exif:GPSDestLongitude" },
1224 { 0x10017,
"exif:GPSDestBearingRef" },
1225 { 0x10018,
"exif:GPSDestBearing" },
1226 { 0x10019,
"exif:GPSDestDistanceRef" },
1227 { 0x1001a,
"exif:GPSDestDistance" },
1228 { 0x1001b,
"exif:GPSProcessingMethod" },
1229 { 0x1001c,
"exif:GPSAreaInformation" },
1230 { 0x1001d,
"exif:GPSDateStamp" },
1231 { 0x1001e,
"exif:GPSDifferential" },
1232 { 0x1001f,
"exif:GPSHPositioningError" },
1244 directory_stack[MaxDirectoryStack] = { { 0, 0, 0 } };
1273 tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
1278 profile=GetImageProfile(image,
"exif");
1280 return(MagickFalse);
1281 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1282 return(MagickFalse);
1283 while (isspace((
int) ((
unsigned char) *property)) != 0)
1285 if (strlen(property) <= 5)
1286 return(MagickFalse);
1289 switch (*(property+5))
1318 tag=(*(
property+5) ==
'@') ? 1UL : 0UL;
1322 return(MagickFalse);
1329 for (i=(ssize_t) n-1L; i >= 0; i--)
1333 if ((c >=
'0') && (c <=
'9'))
1336 if ((c >=
'A') && (c <=
'F'))
1339 if ((c >=
'a') && (c <=
'f'))
1342 return(MagickFalse);
1344 }
while (*property !=
'\0');
1354 if (EXIFTag[i].tag == 0)
1356 if (LocaleCompare(EXIFTag[i].description,property) == 0)
1358 tag=(size_t) EXIFTag[i].tag;
1366 return(MagickFalse);
1367 length=GetStringInfoLength(profile);
1369 return(MagickFalse);
1370 exif=GetStringInfoDatum(profile);
1373 if (ReadPropertyByte(&exif,&length) != 0x45)
1375 if (ReadPropertyByte(&exif,&length) != 0x78)
1377 if (ReadPropertyByte(&exif,&length) != 0x69)
1379 if (ReadPropertyByte(&exif,&length) != 0x66)
1381 if (ReadPropertyByte(&exif,&length) != 0x00)
1383 if (ReadPropertyByte(&exif,&length) != 0x00)
1388 return(MagickFalse);
1389 id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif);
1397 return(MagickFalse);
1398 if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a)
1399 return(MagickFalse);
1403 offset=(ssize_t) ReadPropertySignedLong(endian,exif+4);
1404 if ((offset < 0) || (size_t) offset >= length)
1405 return(MagickFalse);
1410 directory=exif+offset;
1414 exif_resources=NewSplayTree((
int (*)(
const void *,
const void *)) NULL,
1415 (
void *(*)(
void *)) NULL,(
void *(*)(
void *)) NULL);
1424 directory=directory_stack[level].directory;
1425 entry=directory_stack[level].entry;
1426 tag_offset=directory_stack[level].offset;
1428 if ((directory < exif) || (directory > (exif+length-2)))
1433 number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory);
1434 for ( ; entry < number_entries; entry++)
1447 q=(
unsigned char *) (directory+(12*entry)+2);
1448 if (q > (exif+length-12))
1450 if (GetValueFromSplayTree(exif_resources,q) == q)
1452 (void) AddValueToSplayTree(exif_resources,q,q);
1453 tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset;
1454 format=(size_t) ReadPropertyUnsignedShort(endian,q+2);
1455 if (format >= (
sizeof(tag_bytes)/
sizeof(*tag_bytes)))
1459 components=(ssize_t) ReadPropertySignedLong(endian,q+4);
1462 number_bytes=(size_t) components*tag_bytes[format];
1463 if (number_bytes < components)
1465 if (number_bytes <= 4)
1475 dir_offset=(ssize_t) ReadPropertySignedLong(endian,q+8);
1476 if ((dir_offset < 0) || (size_t) dir_offset >= length)
1478 if (((
size_t) dir_offset+number_bytes) < (
size_t) dir_offset)
1480 if (((
size_t) dir_offset+number_bytes) > length)
1482 p=(
unsigned char *) (exif+dir_offset);
1484 if ((all != 0) || (tag == (size_t) tag_value))
1487 buffer[MaxTextExtent],
1490 if ((p < exif) || (p > (exif+length-tag_bytes[format])))
1492 value=(
char *) NULL;
1498 value=(
char *) NULL;
1499 if (~((
size_t) number_bytes) >= 1)
1500 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1502 if (value != (
char *) NULL)
1504 for (i=0; i < (ssize_t) number_bytes; i++)
1507 if (isprint((
int) p[i]) != 0)
1508 value[i]=(char) p[i];
1514 case EXIF_FMT_SBYTE:
1516 EXIFMultipleValues(
"%.20g",(
double) (*(
signed char *) p));
1519 case EXIF_FMT_SSHORT:
1521 EXIFMultipleValues(
"%hd",ReadPropertySignedShort(endian,p));
1524 case EXIF_FMT_USHORT:
1526 EXIFMultipleValues(
"%hu",ReadPropertyUnsignedShort(endian,p));
1529 case EXIF_FMT_ULONG:
1531 EXIFMultipleValues(
"%.20g",(
double)
1532 ReadPropertyUnsignedLong(endian,p));
1535 case EXIF_FMT_SLONG:
1537 EXIFMultipleValues(
"%.20g",(
double)
1538 ReadPropertySignedLong(endian,p));
1541 case EXIF_FMT_URATIONAL:
1543 if ((tag_value == GPS_LATITUDE) || (tag_value == GPS_LONGITUDE) ||
1544 (tag_value == GPS_TIMESTAMP))
1547 EXIFGPSFractions(
"%.20g/%.20g,%.20g/%.20g,%.20g/%.20g",
1548 (
double) ReadPropertyUnsignedLong(endian,p),
1549 (
double) ReadPropertyUnsignedLong(endian,p+4),
1550 (
double) ReadPropertyUnsignedLong(endian,p+8),
1551 (
double) ReadPropertyUnsignedLong(endian,p+12),
1552 (
double) ReadPropertyUnsignedLong(endian,p+16),
1553 (
double) ReadPropertyUnsignedLong(endian,p+20));
1556 EXIFMultipleFractions(
"%.20g/%.20g",(
double)
1557 ReadPropertyUnsignedLong(endian,p),(
double)
1558 ReadPropertyUnsignedLong(endian,p+4));
1561 case EXIF_FMT_SRATIONAL:
1563 EXIFMultipleFractions(
"%.20g/%.20g",(
double)
1564 ReadPropertySignedLong(endian,p),(
double)
1565 ReadPropertySignedLong(endian,p+4));
1568 case EXIF_FMT_SINGLE:
1570 EXIFMultipleValues(
"%.20g",(
double)
1571 ReadPropertySignedLong(endian,p));
1574 case EXIF_FMT_DOUBLE:
1576 EXIFMultipleValues(
"%.20g",(
double)
1577 ReadPropertySignedLong(endian,p));
1580 case EXIF_FMT_STRING:
1581 case EXIF_FMT_UNDEFINED:
1584 if ((p < exif) || (p > (exif+length-number_bytes)))
1586 value=(
char *) NULL;
1587 if (~((
size_t) number_bytes) >= 1)
1588 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1590 if (value != (
char *) NULL)
1595 for (i=0; i < (ssize_t) number_bytes; i++)
1598 if ((isprint((
int) p[i]) != 0) || (p[i] ==
'\0'))
1599 value[i]=(char) p[i];
1606 if (value != (
char *) NULL)
1614 key=AcquireString(property);
1625 description=
"unknown";
1628 if (EXIFTag[i].tag == 0)
1630 if (EXIFTag[i].tag == tag_value)
1632 description=EXIFTag[i].description;
1636 (void) FormatLocaleString(key,MaxTextExtent,
"%s",
1639 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1644 if (tag_value < 0x10000)
1645 (void) FormatLocaleString(key,MaxTextExtent,
"#%04lx",
1646 (
unsigned long) tag_value);
1648 if (tag_value < 0x20000)
1649 (void) FormatLocaleString(key,MaxTextExtent,
"@%04lx",
1650 (
unsigned long) (tag_value & 0xffff));
1652 (
void) FormatLocaleString(key,MaxTextExtent,
"unknown");
1658 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1661 p=(
const char *) NULL;
1662 if (image->properties != (
void *) NULL)
1664 image->properties,key);
1665 if (p == (
const char *) NULL)
1666 (void) SetImageProperty((
Image *) image,key,value);
1667 value=DestroyString(value);
1668 key=DestroyString(key);
1672 if ((tag_value == TAG_EXIF_OFFSET) ||
1673 (tag_value == TAG_INTEROP_OFFSET) || (tag_value == TAG_GPS_OFFSET))
1678 offset=(ssize_t) ReadPropertySignedLong(endian,p);
1679 if (((
size_t) offset < length) && (level < (MaxDirectoryStack-2)))
1684 tag_offset1=(ssize_t) ((tag_value == TAG_GPS_OFFSET) ? 0x10000 :
1686 directory_stack[level].directory=directory;
1688 directory_stack[level].entry=entry;
1689 directory_stack[level].offset=tag_offset;
1694 for (i=0; i < level; i++)
1695 if (directory_stack[i].directory == (exif+tag_offset1))
1699 directory_stack[level].directory=exif+offset;
1700 directory_stack[level].offset=tag_offset1;
1701 directory_stack[level].entry=0;
1703 if ((directory+2+(12*number_entries)+4) > (exif+length))
1705 offset=(ssize_t) ReadPropertySignedLong(endian,directory+2+(12*
1707 if ((offset != 0) && ((size_t) offset < length) &&
1708 (level < (MaxDirectoryStack-2)))
1710 directory_stack[level].directory=exif+offset;
1711 directory_stack[level].entry=0;
1712 directory_stack[level].offset=tag_offset1;
1719 }
while (level > 0);
1720 exif_resources=DestroySplayTree(exif_resources);
1724static MagickBooleanType GetICCProperty(
const Image *image)
1732 profile=GetImageProfile(image,
"icc");
1734 profile=GetImageProfile(image,
"icm");
1736 return(MagickFalse);
1737 if (GetStringInfoLength(profile) < 128)
1738 return(MagickFalse);
1739#if defined(MAGICKCORE_LCMS_DELEGATE)
1744 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
1745 (cmsUInt32Number) GetStringInfoLength(profile));
1746 if (icc_profile != (cmsHPROFILE *) NULL)
1748#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
1752 name=cmsTakeProductName(icc_profile);
1753 if (name != (
const char *) NULL)
1754 (void) SetImageProperty((
Image *) image,
"icc:name",name);
1762 info=AcquireStringInfo(0);
1763 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
"US",
1767 SetStringInfoLength(info,extent+1);
1768 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
1769 "US",(
char *) GetStringInfoDatum(info),extent);
1771 (void) SetImageProperty((
Image *) image,
"icc:description",
1772 (
char *) GetStringInfoDatum(info));
1774 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
"US",
1778 SetStringInfoLength(info,extent+1);
1779 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
1780 "US",(
char *) GetStringInfoDatum(info),extent);
1782 (void) SetImageProperty((
Image *) image,
"icc:manufacturer",
1783 (
char *) GetStringInfoDatum(info));
1785 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1789 SetStringInfoLength(info,extent+1);
1790 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1791 (
char *) GetStringInfoDatum(info),extent);
1793 (void) SetImageProperty((
Image *) image,
"icc:model",
1794 (
char *) GetStringInfoDatum(info));
1796 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
"US",
1800 SetStringInfoLength(info,extent+1);
1801 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
1802 "US",(
char *) GetStringInfoDatum(info),extent);
1804 (void) SetImageProperty((
Image *) image,
"icc:copyright",
1805 (
char *) GetStringInfoDatum(info));
1807 info=DestroyStringInfo(info);
1809 (void) cmsCloseProfile(icc_profile);
1816static MagickBooleanType SkipXMPValue(
const char *value)
1818 if (value == (
const char*) NULL)
1820 while (*value !=
'\0')
1822 if (isspace((
int) ((
unsigned char) *value)) == 0)
1823 return(MagickFalse);
1829static MagickBooleanType GetXMPProperty(
const Image *image,
const char *property)
1856 profile=GetImageProfile(image,
"xmp");
1858 return(MagickFalse);
1859 if (GetStringInfoLength(profile) < 17)
1860 return(MagickFalse);
1861 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1862 return(MagickFalse);
1863 xmp_profile=StringInfoToString(profile);
1864 if (xmp_profile == (
char *) NULL)
1865 return(MagickFalse);
1866 for (p=xmp_profile; *p !=
'\0'; p++)
1867 if ((*p ==
'<') && (*(p+1) ==
'x'))
1869 exception=AcquireExceptionInfo();
1870 xmp=NewXMLTree((
char *) p,exception);
1871 xmp_profile=DestroyString(xmp_profile);
1872 exception=DestroyExceptionInfo(exception);
1874 return(MagickFalse);
1876 rdf=GetXMLTreeChild(xmp,
"rdf:RDF");
1879 if (image->properties == (
void *) NULL)
1880 ((
Image *) image)->properties=NewSplayTree(CompareSplayTreeString,
1881 RelinquishMagickMemory,RelinquishMagickMemory);
1882 description=GetXMLTreeChild(rdf,
"rdf:Description");
1885 node=GetXMLTreeChild(description,(
const char *) NULL);
1891 child=GetXMLTreeChild(node,(
const char *) NULL);
1892 content=GetXMLTreeContent(node);
1894 (SkipXMPValue(content) == MagickFalse))
1896 xmp_namespace=ConstantString(GetXMLTreeTag(node));
1897 (void) SubstituteString(&xmp_namespace,
"exif:",
"xmp:");
1898 (void) AddValueToSplayTree((
SplayTreeInfo *) image->properties,
1899 xmp_namespace,ConstantString(content));
1903 content=GetXMLTreeContent(child);
1904 if (SkipXMPValue(content) == MagickFalse)
1906 xmp_namespace=ConstantString(GetXMLTreeTag(node));
1907 (void) SubstituteString(&xmp_namespace,
"exif:",
"xmp:");
1908 (void) AddValueToSplayTree((
SplayTreeInfo *) image->properties,
1909 xmp_namespace,ConstantString(content));
1911 child=GetXMLTreeSibling(child);
1913 node=GetXMLTreeSibling(node);
1915 description=GetNextXMLTreeTag(description);
1918 xmp=DestroyXMLTree(xmp);
1922static char *TracePSClippath(
const unsigned char *blob,
size_t length,
1923 const size_t magick_unused(columns),
const size_t magick_unused(rows))
1946 magick_unreferenced(columns);
1947 magick_unreferenced(rows);
1949 path=AcquireString((
char *) NULL);
1950 if (path == (
char *) NULL)
1951 return((
char *) NULL);
1952 message=AcquireString((
char *) NULL);
1953 (void) FormatLocaleString(message,MaxTextExtent,
"/ClipImage\n");
1954 (void) ConcatenateString(&path,message);
1955 (void) FormatLocaleString(message,MaxTextExtent,
"{\n");
1956 (void) ConcatenateString(&path,message);
1957 (void) FormatLocaleString(message,MaxTextExtent,
" /c {curveto} bind def\n");
1958 (void) ConcatenateString(&path,message);
1959 (void) FormatLocaleString(message,MaxTextExtent,
" /l {lineto} bind def\n");
1960 (void) ConcatenateString(&path,message);
1961 (void) FormatLocaleString(message,MaxTextExtent,
" /m {moveto} bind def\n");
1962 (void) ConcatenateString(&path,message);
1963 (void) FormatLocaleString(message,MaxTextExtent,
1964 " /v {currentpoint 6 2 roll curveto} bind def\n");
1965 (void) ConcatenateString(&path,message);
1966 (void) FormatLocaleString(message,MaxTextExtent,
1967 " /y {2 copy curveto} bind def\n");
1968 (void) ConcatenateString(&path,message);
1969 (void) FormatLocaleString(message,MaxTextExtent,
1970 " /z {closepath} bind def\n");
1971 (void) ConcatenateString(&path,message);
1972 (void) FormatLocaleString(message,MaxTextExtent,
" newpath\n");
1973 (void) ConcatenateString(&path,message);
1978 (void) memset(point,0,
sizeof(point));
1979 (void) memset(first,0,
sizeof(first));
1980 (void) memset(last,0,
sizeof(last));
1982 in_subpath=MagickFalse;
1985 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
1991 if (knot_count != 0)
1994 length-=MagickMin(24,(ssize_t) length);
2000 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2002 length-=MagickMin(22,(ssize_t) length);
2010 if (knot_count == 0)
2016 length-=MagickMin(24,(ssize_t) length);
2022 for (i=0; i < 3; i++)
2024 y=(size_t) ReadPropertyMSBLong(&blob,&length);
2025 x=(size_t) ReadPropertyMSBLong(&blob,&length);
2026 point[i].x=(double) x/4096.0/4096.0;
2027 point[i].y=1.0-(double) y/4096.0/4096.0;
2029 if (in_subpath == MagickFalse)
2031 (void) FormatLocaleString(message,MaxTextExtent,
" %g %g m\n",
2032 point[1].x,point[1].y);
2033 for (i=0; i < 3; i++)
2045 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2046 (point[0].x == point[1].x) && (point[0].y == point[1].y))
2047 (void) FormatLocaleString(message,MaxTextExtent,
2048 " %g %g l\n",point[1].x,point[1].y);
2050 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2051 (void) FormatLocaleString(message,MaxTextExtent,
2052 " %g %g %g %g v\n",point[0].x,point[0].y,
2053 point[1].x,point[1].y);
2055 if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
2056 (void) FormatLocaleString(message,MaxTextExtent,
2057 " %g %g %g %g y\n",last[2].x,last[2].y,
2058 point[1].x,point[1].y);
2060 (
void) FormatLocaleString(message,MaxTextExtent,
2061 " %g %g %g %g %g %g c\n",last[2].x,
2062 last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
2063 for (i=0; i < 3; i++)
2066 (void) ConcatenateString(&path,message);
2067 in_subpath=MagickTrue;
2072 if (knot_count == 0)
2078 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2079 (first[0].x == first[1].x) && (first[0].y == first[1].y))
2080 (void) FormatLocaleString(message,MaxTextExtent,
2081 " %g %g l z\n",first[1].x,first[1].y);
2083 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2084 (void) FormatLocaleString(message,MaxTextExtent,
2085 " %g %g %g %g v z\n",first[0].x,first[0].y,
2086 first[1].x,first[1].y);
2088 if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
2089 (void) FormatLocaleString(message,MaxTextExtent,
2090 " %g %g %g %g y z\n",last[2].x,last[2].y,
2091 first[1].x,first[1].y);
2093 (
void) FormatLocaleString(message,MaxTextExtent,
2094 " %g %g %g %g %g %g c z\n",last[2].x,
2095 last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
2096 (void) ConcatenateString(&path,message);
2097 in_subpath=MagickFalse;
2107 length-=MagickMin(24,(ssize_t) length);
2115 (void) FormatLocaleString(message,MaxTextExtent,
" eoclip\n");
2116 (void) ConcatenateString(&path,message);
2117 (void) FormatLocaleString(message,MaxTextExtent,
"} bind def");
2118 (void) ConcatenateString(&path,message);
2119 message=DestroyString(message);
2123static inline void TraceBezierCurve(
char *message,
PointInfo *last,
2130 if (((last+1)->x == (last+2)->x) && ((last+1)->y == (last+2)->y) &&
2131 (point->x == (point+1)->x) && (point->y == (point+1)->y))
2132 (void) FormatLocaleString(message,MagickPathExtent,
2133 "L %g %g\n",point[1].x,point[1].y);
2135 (
void) FormatLocaleString(message,MagickPathExtent,
"C %g %g %g %g %g %g\n",
2136 (last+2)->x,(last+2)->y,point->x,point->y,(point+1)->x,(point+1)->y);
2139static char *TraceSVGClippath(
const unsigned char *blob,
size_t length,
2140 const size_t columns,
const size_t rows)
2163 path=AcquireString((
char *) NULL);
2164 if (path == (
char *) NULL)
2165 return((
char *) NULL);
2166 message=AcquireString((
char *) NULL);
2167 (void) FormatLocaleString(message,MaxTextExtent,(
2168 "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
2169 "<svg xmlns=\"http://www.w3.org/2000/svg\""
2170 " width=\"%.20g\" height=\"%.20g\">\n"
2172 "<path fill-rule=\"evenodd\" style=\"fill:#000000;stroke:#000000;"
2173 "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),(double) columns,
2175 (void) ConcatenateString(&path,message);
2176 (void) memset(point,0,
sizeof(point));
2177 (void) memset(first,0,
sizeof(first));
2178 (void) memset(last,0,
sizeof(last));
2180 in_subpath=MagickFalse;
2183 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2189 if (knot_count != 0)
2192 length-=MagickMin(24,(ssize_t) length);
2198 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2200 length-=MagickMin(22,(ssize_t) length);
2208 if (knot_count == 0)
2214 length-=MagickMin(24,(ssize_t) length);
2220 for (i=0; i < 3; i++)
2222 y=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2223 x=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2224 point[i].x=(double) x*columns/4096.0/4096.0;
2225 point[i].y=(double) y*rows/4096.0/4096.0;
2227 if (in_subpath == MagickFalse)
2229 (void) FormatLocaleString(message,MaxTextExtent,
"M %g %g\n",
2230 point[1].x,point[1].y);
2231 for (i=0; i < 3; i++)
2239 TraceBezierCurve(message,last,point);
2240 for (i=0; i < 3; i++)
2243 (void) ConcatenateString(&path,message);
2244 in_subpath=MagickTrue;
2249 if (knot_count == 0)
2251 TraceBezierCurve(message,last,first);
2252 (void) ConcatenateString(&path,message);
2253 in_subpath=MagickFalse;
2263 length-=MagickMin(24,(ssize_t) length);
2271 (void) ConcatenateString(&path,
"\"/>\n</g>\n</svg>\n");
2272 message=DestroyString(message);
2276MagickExport
const char *GetImageProperty(
const Image *image,
2277 const char *property)
2294 assert(image != (
Image *) NULL);
2295 assert(image->signature == MagickCoreSignature);
2296 if (IsEventLogging() != MagickFalse)
2297 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2298 p=(
const char *) NULL;
2299 if (image->properties != (
void *) NULL)
2301 if (property == (
const char *) NULL)
2303 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
2308 if (LocaleNCompare(
"fx:",property,3) != 0)
2311 image->properties,property);
2312 if (p != (
const char *) NULL)
2316 if ((property == (
const char *) NULL) ||
2317 (strchr(property,
':') == (
char *) NULL))
2319 exception=(&((
Image *) image)->exception);
2324 if (LocaleNCompare(
"8bim:",property,5) == 0)
2326 (void) Get8BIMProperty(image,property);
2334 if (LocaleNCompare(
"exif:",property,5) == 0)
2336 (void) GetEXIFProperty(image,property);
2344 if (LocaleNCompare(
"fx:",property,3) == 0)
2346 if ((image->columns == 0) || (image->rows == 0))
2348 fx_info=AcquireFxInfo(image,property+3);
2349 status=FxEvaluateChannelExpression(fx_info,DefaultChannels,0,0,&alpha,
2351 fx_info=DestroyFxInfo(fx_info);
2352 if (status != MagickFalse)
2355 value[MaxTextExtent];
2357 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
2358 GetMagickPrecision(),(double) alpha);
2359 (void) SetImageProperty((
Image *) image,property,value);
2368 if (LocaleNCompare(
"hex:",property,4) == 0)
2373 if ((image->columns == 0) || (image->rows == 0))
2375 GetMagickPixelPacket(image,&pixel);
2376 fx_info=AcquireFxInfo(image,property+4);
2377 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2379 pixel.red=(MagickRealType) QuantumRange*alpha;
2380 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2382 pixel.green=(MagickRealType) QuantumRange*alpha;
2383 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2385 pixel.blue=(MagickRealType) QuantumRange*alpha;
2386 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2388 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2389 if (image->colorspace == CMYKColorspace)
2391 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2393 pixel.index=(MagickRealType) QuantumRange*alpha;
2395 fx_info=DestroyFxInfo(fx_info);
2396 if (status != MagickFalse)
2401 GetColorTuple(&pixel,MagickTrue,hex);
2402 (void) SetImageProperty((
Image *) image,property,hex+1);
2411 if ((LocaleNCompare(
"icc:",property,4) == 0) ||
2412 (LocaleNCompare(
"icm:",property,4) == 0))
2414 (void) GetICCProperty(image);
2417 if (LocaleNCompare(
"iptc:",property,5) == 0)
2419 (void) GetIPTCProperty(image,property);
2427 if (LocaleNCompare(
"pixel:",property,6) == 0)
2432 GetMagickPixelPacket(image,&pixel);
2433 fx_info=AcquireFxInfo(image,property+6);
2434 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2436 pixel.red=(MagickRealType) QuantumRange*alpha;
2437 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2439 pixel.green=(MagickRealType) QuantumRange*alpha;
2440 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2442 pixel.blue=(MagickRealType) QuantumRange*alpha;
2443 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2445 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2446 if (image->colorspace == CMYKColorspace)
2448 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2450 pixel.index=(MagickRealType) QuantumRange*alpha;
2452 fx_info=DestroyFxInfo(fx_info);
2453 if (status != MagickFalse)
2456 name[MaxTextExtent];
2461 GetColorTuple(&pixel,MagickFalse,name);
2462 value=GetImageArtifact(image,
"pixel:compliance");
2463 if (value != (
char *) NULL)
2465 ComplianceType compliance=(ComplianceType) ParseCommandOption(
2466 MagickComplianceOptions,MagickFalse,value);
2467 (void) QueryMagickColorname(image,&pixel,compliance,name,
2470 (void) SetImageProperty((
Image *) image,property,name);
2479 if (LocaleNCompare(
"xmp:",property,4) == 0)
2481 (void) GetXMPProperty(image,property);
2489 if (image->properties != (
void *) NULL)
2492 image->properties,property);
2495 return((
const char *) NULL);
2584static const char *GetMagickPropertyLetter(
const ImageInfo *image_info,
2585 Image *image,
const char letter)
2587#define WarnNoImageInfoReturn(format,arg) \
2588 if (image_info == (ImageInfo *) NULL ) { \
2589 (void) ThrowMagickException(&image->exception,GetMagickModule(), \
2590 OptionWarning,"NoImageInfoForProperty",format,arg); \
2591 return((const char *) NULL); \
2595 value[MaxTextExtent];
2600 assert(image != (
Image *) NULL);
2601 assert(image->signature == MagickCoreSignature);
2602 if (IsEventLogging() != MagickFalse)
2603 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2605 string=(
char *) NULL;
2613 (void) FormatMagickSize(image->extent,MagickFalse,value);
2614 if (image->extent == 0)
2615 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
2623 string=GetImageProperty(image,
"comment");
2624 if (
string == (
const char *) NULL)
2633 GetPathComponent(image->magick_filename,HeadPath,value);
2643 GetPathComponent(image->magick_filename,ExtensionPath,value);
2653 GetPathComponent(image->magick_filename,TailPath,value);
2663 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
2664 (
double) image->page.width,(double) image->page.height,
2665 (
double) image->page.x,(double) image->page.y);
2673 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2674 (image->rows != 0 ? image->rows : image->magick_rows));
2682 string=image->filename;
2690 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2691 GetNumberColors(image,(FILE *) NULL,&image->exception));
2699 string=GetImageProperty(image,
"label");
2700 if (
string == (
const char *) NULL)
2709 string=image->magick;
2717 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2718 GetImageListLength(image));
2726 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2727 string=image_info->filename;
2735 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2736 GetImageIndexInList(image));
2744 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2745 MAGICKCORE_QUANTUM_DEPTH);
2756 colorspace=image->colorspace;
2757 if ((image->columns != 0) && (image->rows != 0) &&
2758 (SetImageGray(image,&image->exception) != MagickFalse))
2759 colorspace=GRAYColorspace;
2760 (void) FormatLocaleString(value,MaxTextExtent,
"%s %s %s",
2761 CommandOptionToMnemonic(MagickClassOptions,(ssize_t)
2762 image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions,
2763 (ssize_t) colorspace),image->matte != MagickFalse ?
"Matte" :
"" );
2771 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2772 if (image_info->number_scenes != 0)
2773 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2776 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2785 GetPathComponent(image->magick_filename,BasePath,value);
2795 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2796 string=image_info->unique;
2804 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2805 (image->columns != 0 ? image->columns : image->magick_columns));
2813 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2814 fabs(image->x_resolution) > MagickEpsilon ? image->x_resolution :
2815 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2824 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2825 fabs(image->y_resolution) > MagickEpsilon ? image->y_resolution :
2826 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2835 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2844 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2845 CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte));
2853 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2855 if (image->extent == 0)
2856 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2857 GetBlobSize(image));
2865 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2866 CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
2867 image->compression));
2875 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2876 CommandOptionToMnemonic(MagickDisposeOptions,(ssize_t) image->dispose));
2889 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "
2890 "$-_.+!*'(),{}|\\^~[]`\"><#%;/?:@&=";
2895 (void) CopyMagickString(value,image->magick_filename,MaxTextExtent);
2897 q=value+strlen(value);
2898 for (p+=strspn(p,allowlist); p != q; p+=strspn(p,allowlist))
2907 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2908 image->magick_columns,(double) image->magick_rows);
2916 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2917 image->page.height);
2925 string=image->magick_filename;
2930 if ((image != (
Image *) NULL) && (image->next == (
Image *) NULL))
2931 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g\n",(
double)
2932 GetImageListLength(image));
2942 (void) FormatLocaleString(value,MaxTextExtent,
"%+ld%+ld",(
long)
2943 image->page.x,(long) image->page.y);
2951 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2952 image->page.width,(double) image->page.height);
2960 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2961 (image->quality == 0 ? 92 : image->quality));
2969 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2970 if (image_info->number_scenes == 0)
2971 string=
"2147483647";
2973 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2974 image_info->scene+image_info->number_scenes);
2982 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2991 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2992 CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
3001 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3010 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
3019 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
3028 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
3029 string=image_info->zero;
3040 page=GetImageBoundingBox(image,&image->exception);
3041 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
3042 (
double) page.width,(double) page.height,(
double) page.x,(double)
3051 if ((image->columns != 0) && (image->rows != 0))
3052 (void) SignatureImage(image);
3053 string=GetImageProperty(image,
"signature");
3067 if (
string != (
char *) NULL)
3069 (void) SetImageArtifact(image,
"get-property",
string);
3070 return(GetImageArtifact(image,
"get-property"));
3072 return((
char *) NULL);
3075MagickExport
const char *GetMagickProperty(
const ImageInfo *image_info,
3076 Image *image,
const char *property)
3079 value[MaxTextExtent];
3084 assert(property != (
const char *) NULL);
3085 assert(property[0] !=
'\0');
3086 if (property[1] ==
'\0')
3087 return(GetMagickPropertyLetter(image_info,image,*property));
3089 string=(
char *) NULL;
3094 if ((LocaleCompare(
"base",property) == 0) ||
3095 (LocaleCompare(
"basename",property) == 0) )
3097 GetPathComponent(image->magick_filename,BasePath,value);
3100 if (LocaleCompare(
"bit-depth",property) == 0)
3102 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3103 GetImageDepth(image,&image->exception));
3106 if (LocaleCompare(
"bounding-box",property) == 0)
3111 geometry=GetImageBoundingBox(image,&image->exception);
3112 (void) FormatLocaleString(value,MagickPathExtent,
"%g,%g %g,%g\n",
3113 (
double) geometry.x,(double) geometry.y,
3114 (
double) geometry.x+geometry.width,
3115 (double) geometry.y+geometry.height);
3122 if (LocaleCompare(
"channels",property) == 0)
3127 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
3128 CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3129 image->colorspace));
3131 if (image->matte != MagickFalse)
3132 (void) ConcatenateMagickString(value,
"a",MaxTextExtent);
3135 if (LocaleCompare(
"colors",property) == 0)
3137 image->colors=GetNumberColors(image,(FILE *) NULL,&image->exception);
3138 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3142 if (LocaleCompare(
"colorspace",property) == 0)
3144 string=CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3148 if (LocaleCompare(
"compose",property) == 0)
3150 string=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t)
3154 if (LocaleCompare(
"compression",property) == 0)
3156 string=CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
3157 image->compression);
3160 if (LocaleCompare(
"copyright",property) == 0)
3162 (void) CopyMagickString(value,GetMagickCopyright(),MaxTextExtent);
3169 if (LocaleCompare(
"depth",property) == 0)
3171 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3175 if (LocaleCompare(
"directory",property) == 0)
3177 GetPathComponent(image->magick_filename,HeadPath,value);
3184 if (LocaleCompare(
"entropy",property) == 0)
3189 (void) GetImageChannelEntropy(image,image_info->channel,&entropy,
3191 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3192 GetMagickPrecision(),entropy);
3195 if (LocaleCompare(
"extension",property) == 0)
3197 GetPathComponent(image->magick_filename,ExtensionPath,value);
3204 if (LocaleCompare(
"gamma",property) == 0)
3206 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3207 GetMagickPrecision(),image->gamma);
3210 if ((image_info != (
ImageInfo *) NULL) &&
3211 (LocaleCompare(
"group",property) == 0))
3213 (void) FormatLocaleString(value,MaxTextExtent,
"0x%lx",(
unsigned long)
3221 if (LocaleCompare(
"height",property) == 0)
3223 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3224 image->magick_rows != 0 ? (
double) image->magick_rows : 256.0);
3231 if (LocaleCompare(
"input",property) == 0)
3233 string=image->filename;
3236 if (LocaleCompare(
"interlace",property) == 0)
3238 string=CommandOptionToMnemonic(MagickInterlaceOptions,(ssize_t)
3246 if (LocaleCompare(
"kurtosis",property) == 0)
3252 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3253 &skewness,&image->exception);
3254 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3255 GetMagickPrecision(),kurtosis);
3262 if (LocaleCompare(
"magick",property) == 0)
3264 string=image->magick;
3267 if ((LocaleCompare(
"max",property) == 0) ||
3268 (LocaleCompare(
"maxima",property) == 0))
3274 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3275 &maximum,&image->exception);
3276 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3277 GetMagickPrecision(),maximum);
3280 if (LocaleCompare(
"mean",property) == 0)
3286 (void) GetImageChannelMean(image,image_info->channel,&mean,
3287 &standard_deviation,&image->exception);
3288 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3289 GetMagickPrecision(),mean);
3292 if ((LocaleCompare(
"min",property) == 0) ||
3293 (LocaleCompare(
"minima",property) == 0))
3299 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3300 &maximum,&image->exception);
3301 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3302 GetMagickPrecision(),minimum);
3309 if (LocaleCompare(
"opaque",property) == 0)
3314 opaque=IsOpaqueImage(image,&image->exception);
3315 (void) CopyMagickString(value,opaque != MagickFalse ?
"true" :
3316 "false",MaxTextExtent);
3319 if (LocaleCompare(
"orientation",property) == 0)
3321 string=CommandOptionToMnemonic(MagickOrientationOptions,(ssize_t)
3322 image->orientation);
3325 if ((image_info != (
ImageInfo *) NULL) &&
3326 (LocaleCompare(
"output",property) == 0))
3328 (void) CopyMagickString(value,image_info->filename,MaxTextExtent);
3335 if (LocaleCompare(
"page",property) == 0)
3337 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
3338 image->page.width,(double) image->page.height);
3341 if (LocaleNCompare(
"papersize:",property,10) == 0)
3347 papersize=GetPageGeometry(property+10);
3348 if (papersize != (
const char *) NULL)
3351 page = { 0, 0, 0, 0 };
3353 (void) ParseAbsoluteGeometry(papersize,&page);
3354 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",
3355 (
double) page.width,(double) page.height);
3356 papersize=DestroyString(papersize);
3360#if defined(MAGICKCORE_LCMS_DELEGATE)
3361 if (LocaleCompare(
"profile:icc",property) == 0 ||
3362 LocaleCompare(
"profile:icm",property) == 0)
3364#if !defined(LCMS_VERSION) || (LCMS_VERSION < 2000)
3365#define cmsUInt32Number DWORD
3374 profile=GetImageProfile(image,property+8);
3378 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
3379 (cmsUInt32Number) GetStringInfoLength(profile));
3380 if (icc_profile != (cmsHPROFILE *) NULL)
3382#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
3383 string=cmsTakeProductName(icc_profile);
3385 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
3386 "en",
"US",value,MaxTextExtent);
3388 (void) cmsCloseProfile(icc_profile);
3392 if (LocaleCompare(
"printsize.x",property) == 0)
3394 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3395 GetMagickPrecision(),PerceptibleReciprocal(image->x_resolution)*
3399 if (LocaleCompare(
"printsize.y",property) == 0)
3401 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3402 GetMagickPrecision(),PerceptibleReciprocal(image->y_resolution)*
3406 if (LocaleCompare(
"profiles",property) == 0)
3411 ResetImageProfileIterator(image);
3412 name=GetNextImageProfile(image);
3413 if (name != (
char *) NULL)
3415 (void) CopyMagickString(value,name,MaxTextExtent);
3416 name=GetNextImageProfile(image);
3417 while (name != (
char *) NULL)
3419 ConcatenateMagickString(value,
",",MaxTextExtent);
3420 ConcatenateMagickString(value,name,MaxTextExtent);
3421 name=GetNextImageProfile(image);
3430 if (LocaleCompare(
"quality",property) == 0)
3432 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3440 if (LocaleCompare(
"rendering-intent",property) == 0)
3442 string=CommandOptionToMnemonic(MagickIntentOptions,(ssize_t)
3443 image->rendering_intent);
3446 if (LocaleCompare(
"resolution.x",property) == 0)
3448 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3449 image->x_resolution);
3452 if (LocaleCompare(
"resolution.y",property) == 0)
3454 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3455 image->y_resolution);
3462 if (LocaleCompare(
"scene",property) == 0)
3464 if ((image_info != (
ImageInfo *) NULL) &&
3465 (image_info->number_scenes != 0))
3466 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3469 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3473 if (LocaleCompare(
"scenes",property) == 0)
3475 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3476 GetImageListLength(image));
3479 if (LocaleCompare(
"size",property) == 0)
3481 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
3484 if (LocaleCompare(
"skewness",property) == 0)
3490 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3491 &skewness,&image->exception);
3492 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3493 GetMagickPrecision(),skewness);
3496 if ((LocaleCompare(
"standard-deviation",property) == 0) ||
3497 (LocaleCompare(
"standard_deviation",property) == 0))
3503 (void) GetImageChannelMean(image,image_info->channel,&mean,
3504 &standard_deviation,&image->exception);
3505 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3506 GetMagickPrecision(),standard_deviation);
3513 if (LocaleCompare(
"type",property) == 0)
3515 string=CommandOptionToMnemonic(MagickTypeOptions,(ssize_t)
3516 IdentifyImageType(image,&image->exception));
3523 if ((image_info != (
ImageInfo *) NULL) &&
3524 (LocaleCompare(
"unique",property) == 0))
3526 string=image_info->unique;
3529 if (LocaleCompare(
"units",property) == 0)
3534 string=CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
3542 if (LocaleCompare(
"version",property) == 0)
3544 string=GetMagickVersion((
size_t *) NULL);
3551 if (LocaleCompare(
"width",property) == 0)
3553 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3554 (image->magick_columns != 0 ? image->magick_columns : 256));
3561 if ((LocaleCompare(
"xresolution",property) == 0) ||
3562 (LocaleCompare(
"x-resolution",property) == 0) )
3564 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3565 image->x_resolution);
3572 if ((LocaleCompare(
"yresolution",property) == 0) ||
3573 (LocaleCompare(
"y-resolution",property) == 0) )
3575 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3576 image->y_resolution);
3583 if ((image_info != (
ImageInfo *) NULL) &&
3584 (LocaleCompare(
"zero",property) == 0))
3586 string=image_info->zero;
3594 if (
string != (
char *) NULL)
3596 (void) SetImageArtifact(image,
"get-property",
string);
3597 return(GetImageArtifact(image,
"get-property"));
3599 return((
char *) NULL);
3624MagickExport
char *GetNextImageProperty(
const Image *image)
3626 assert(image != (
Image *) NULL);
3627 assert(image->signature == MagickCoreSignature);
3628 if (IsEventLogging() != MagickFalse)
3629 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
3631 if (image->properties == (
void *) NULL)
3632 return((
char *) NULL);
3633 return((
char *) GetNextKeyInSplayTree((
SplayTreeInfo *) image->properties));
3688MagickExport
char *InterpretImageProperties(
const ImageInfo *image_info,
3689 Image *image,
const char *embed_text)
3691#define ExtendInterpretText(string_length) \
3693 size_t length=(string_length); \
3694 if ((size_t) (q-interpret_text+length+1) >= extent) \
3697 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3698 MaxTextExtent,sizeof(*interpret_text)); \
3699 if (interpret_text == (char *) NULL) \
3701 if (property_info != image_info) \
3702 property_info=DestroyImageInfo(property_info); \
3703 return((char *) NULL); \
3705 q=interpret_text+strlen(interpret_text); \
3709#define AppendKeyValue2Text(key,value)\
3711 size_t length=strlen(key)+strlen(value)+2; \
3712 if ((size_t) (q-interpret_text+length+1) >= extent) \
3715 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3716 MaxTextExtent,sizeof(*interpret_text)); \
3717 if (interpret_text == (char *) NULL) \
3719 if (property_info != image_info) \
3720 property_info=DestroyImageInfo(property_info); \
3721 return((char *) NULL); \
3723 q=interpret_text+strlen(interpret_text); \
3725 q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(value)); \
3728#define AppendString2Text(string) \
3730 size_t length=strlen((string)); \
3731 if ((size_t) (q-interpret_text+length+1) >= extent) \
3734 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3735 MaxTextExtent,sizeof(*interpret_text)); \
3736 if (interpret_text == (char *) NULL) \
3738 if (property_info != image_info) \
3739 property_info=DestroyImageInfo(property_info); \
3740 return((char *) NULL); \
3742 q=interpret_text+strlen(interpret_text); \
3744 (void) CopyMagickString(q,(string),extent); \
3766 assert(image != (
Image *) NULL);
3767 assert(image->signature == MagickCoreSignature);
3768 if (IsEventLogging() != MagickFalse)
3769 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
3770 if (embed_text == (
const char *) NULL)
3771 return(ConstantString(
""));
3773 while ((isspace((
int) ((
unsigned char) *p)) != 0) && (*p !=
'\0'))
3776 return(ConstantString(
""));
3777 if ((*p ==
'@') && (IsPathAccessible(p+1) != MagickFalse))
3782 if (IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,p) == MagickFalse)
3785 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3786 PolicyError,
"NotAuthorized",
"`%s'",p);
3787 return(ConstantString(
""));
3789 interpret_text=FileToString(p,~0UL,&image->exception);
3790 if (interpret_text != (
char *) NULL)
3791 return(interpret_text);
3799 property_info=CloneImageInfo(image_info);
3800 interpret_text=AcquireString(embed_text);
3801 extent=MaxTextExtent;
3803 for (q=interpret_text; *p!=
'\0';
3804 number=(isdigit((
int) ((
unsigned char) *p))) ? MagickTrue : MagickFalse,p++)
3810 ExtendInterpretText(MaxTextExtent);
3853 if (LocaleNCompare(
"<",p,4) == 0)
3859 if (LocaleNCompare(
">",p,4) == 0)
3865 if (LocaleNCompare(
"&",p,5) == 0)
3886 if ((*p ==
'\0') || (*p ==
'\'') || (*p ==
'"'))
3902 if (number != MagickFalse)
3908 value=GetMagickPropertyLetter(property_info,image,*p);
3909 if (value != (
char *) NULL)
3911 AppendString2Text(value);
3914 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3915 OptionWarning,
"UnknownImageProperty",
"\"%%%c\"",*p);
3920 pattern[2*MaxTextExtent] =
"\0";
3939 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3940 OptionWarning,
"UnknownImageProperty",
"\"%%[]\"");
3943 for (len=0; len<(MaxTextExtent-1L) && (*p !=
'\0');)
3945 if ((*p ==
'\\') && (*(p+1) !=
'\0'))
3950 pattern[len++]=(*p++);
3951 pattern[len++]=(*p++);
3960 pattern[len++]=(*p++);
3975 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3976 OptionError,
"UnbalancedBraces",
"\"%%[%s\"",pattern);
3977 interpret_text=DestroyString(interpret_text);
3978 if (property_info != image_info)
3979 property_info=DestroyImageInfo(property_info);
3980 return((
char *) NULL);
3985 if (LocaleNCompare(
"fx:",pattern,3) == 0)
3999 fx_info=AcquireFxInfo(image,pattern+3);
4000 status=FxEvaluateChannelExpression(fx_info,property_info->channel,0,0,
4001 &value,&image->exception);
4002 fx_info=DestroyFxInfo(fx_info);
4003 if (status != MagickFalse)
4006 result[MagickPathExtent];
4008 (void) FormatLocaleString(result,MagickPathExtent,
"%.*g",
4009 GetMagickPrecision(),(double) value);
4010 AppendString2Text(result);
4014 if (LocaleNCompare(
"option:",pattern,7) == 0)
4019 if (IsGlob(pattern+7) != MagickFalse)
4021 ResetImageOptionIterator(property_info);
4022 while ((key=GetNextImageOption(property_info)) != (
const char *) NULL)
4023 if (GlobExpression(key,pattern+7,MagickTrue) != MagickFalse)
4025 value=GetImageOption(property_info,key);
4026 if (value != (
const char *) NULL)
4027 AppendKeyValue2Text(key,value);
4032 value=GetImageOption(property_info,pattern+7);
4033 if (value != (
char *) NULL)
4034 AppendString2Text(value);
4038 if (LocaleNCompare(
"artifact:",pattern,9) == 0)
4043 if (IsGlob(pattern+9) != MagickFalse)
4045 ResetImageArtifactIterator(image);
4046 while ((key=GetNextImageArtifact(image)) != (
const char *) NULL)
4047 if (GlobExpression(key,pattern+9,MagickTrue) != MagickFalse)
4049 value=GetImageArtifact(image,key);
4050 if (value != (
const char *) NULL)
4051 AppendKeyValue2Text(key,value);
4056 value=GetImageArtifact(image,pattern+9);
4057 if (value != (
char *) NULL)
4058 AppendString2Text(value);
4068 value=GetImageProperty(image,pattern);
4069 if (value != (
const char *) NULL)
4071 AppendString2Text(value);
4078 if (IsGlob(pattern) != MagickFalse)
4080 ResetImagePropertyIterator(image);
4081 while ((key=GetNextImageProperty(image)) != (
const char *) NULL)
4082 if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
4084 value=GetImageProperty(image,key);
4085 if (value != (
const char *) NULL)
4086 AppendKeyValue2Text(key,value);
4096 value=GetMagickProperty(property_info,image,pattern);
4097 if (value != (
const char *) NULL)
4099 AppendString2Text(value);
4105 value=GetImageArtifact(image,pattern);
4106 if (value != (
char *) NULL)
4108 AppendString2Text(value);
4114 value=GetImageOption(property_info,pattern);
4115 if (value != (
char *) NULL)
4117 AppendString2Text(value);
4130 (void) ThrowMagickException(&image->exception,GetMagickModule(),
4131 OptionWarning,
"UnknownImageProperty",
"\"%%[%s]\"",pattern);
4136 if (property_info != image_info)
4137 property_info=DestroyImageInfo(property_info);
4138 return(interpret_text);
4169MagickExport
char *RemoveImageProperty(
Image *image,
const char *property)
4174 assert(image != (
Image *) NULL);
4175 assert(image->signature == MagickCoreSignature);
4176 if (IsEventLogging() != MagickFalse)
4177 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4179 if (image->properties == (
void *) NULL)
4180 return((
char *) NULL);
4181 value=(
char *) RemoveNodeFromSplayTree((
SplayTreeInfo *) image->properties,
4210MagickExport
void ResetImagePropertyIterator(
const Image *image)
4212 assert(image != (
Image *) NULL);
4213 assert(image->signature == MagickCoreSignature);
4214 if (IsEventLogging() != MagickFalse)
4215 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4217 if (image->properties == (
void *) NULL)
4219 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
4250MagickExport MagickBooleanType SetImageProperty(
Image *image,
4251 const char *property,
const char *value)
4266 assert(image != (
Image *) NULL);
4267 assert(image->signature == MagickCoreSignature);
4268 if (IsEventLogging() != MagickFalse)
4269 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4271 if (image->properties == (
void *) NULL)
4272 image->properties=NewSplayTree(CompareSplayTreeString,
4273 RelinquishMagickMemory,RelinquishMagickMemory);
4274 if (value == (
const char *) NULL)
4275 return(DeleteImageProperty(image,property));
4276 exception=(&image->exception);
4277 property_length=strlen(property);
4278 if ((property_length > 2) && (*(property+(property_length-2)) ==
':') &&
4279 (*(property+(property_length-1)) ==
'*'))
4281 (void) ThrowMagickException(exception,GetMagickModule(),
4282 OptionWarning,
"SetReadOnlyProperty",
"`%s'",property);
4283 return(MagickFalse);
4298 if (LocaleCompare(
"background",property) == 0)
4300 (void) QueryColorDatabase(value,&image->background_color,exception);
4303 if (LocaleCompare(
"bias",property) == 0)
4305 image->bias=StringToDoubleInterval(value,(
double) QuantumRange+1.0);
4308 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4309 ConstantString(property),ConstantString(value));
4315 if (LocaleCompare(
"colorspace",property) == 0)
4320 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
4324 status=SetImageColorspace(image,(ColorspaceType) colorspace);
4327 if (LocaleCompare(
"compose",property) == 0)
4332 compose=ParseCommandOption(MagickComposeOptions,MagickFalse,value);
4335 image->compose=(CompositeOperator) compose;
4338 if (LocaleCompare(
"compress",property) == 0)
4343 compression=ParseCommandOption(MagickCompressOptions,MagickFalse,
4345 if (compression < 0)
4347 image->compression=(CompressionType) compression;
4350 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4351 ConstantString(property),ConstantString(value));
4357 if (LocaleCompare(
"delay",property) == 0)
4362 flags=ParseGeometry(value,&geometry_info);
4363 if ((flags & GreaterValue) != 0)
4365 if (image->delay > (
size_t) floor(geometry_info.rho+0.5))
4366 image->delay=(size_t) floor(geometry_info.rho+0.5);
4369 if ((flags & LessValue) != 0)
4371 if ((
double) image->delay < floor(geometry_info.rho+0.5))
4372 image->ticks_per_second=CastDoubleToLong(
4373 floor(geometry_info.sigma+0.5));
4376 image->delay=(size_t) floor(geometry_info.rho+0.5);
4377 if ((flags & SigmaValue) != 0)
4378 image->ticks_per_second=CastDoubleToLong(floor(
4379 geometry_info.sigma+0.5));
4382 if (LocaleCompare(
"density",property) == 0)
4387 flags=ParseGeometry(value,&geometry_info);
4388 if ((flags & RhoValue) != 0)
4389 image->x_resolution=geometry_info.rho;
4390 image->y_resolution=image->x_resolution;
4391 if ((flags & SigmaValue) != 0)
4392 image->y_resolution=geometry_info.sigma;
4394 if (LocaleCompare(
"depth",property) == 0)
4396 image->depth=StringToUnsignedLong(value);
4399 if (LocaleCompare(
"dispose",property) == 0)
4404 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,value);
4407 image->dispose=(DisposeType) dispose;
4410 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4411 ConstantString(property),ConstantString(value));
4417 if (LocaleCompare(
"gamma",property) == 0)
4419 image->gamma=StringToDouble(value,(
char **) NULL);
4422 if (LocaleCompare(
"gravity",property) == 0)
4427 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value);
4430 image->gravity=(GravityType) gravity;
4433 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4434 ConstantString(property),ConstantString(value));
4440 if (LocaleCompare(
"intensity",property) == 0)
4445 intensity=ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
4449 image->intensity=(PixelIntensityMethod) intensity;
4452 if (LocaleCompare(
"interpolate",property) == 0)
4457 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
4459 if (interpolate < 0)
4461 image->interpolate=(InterpolatePixelMethod) interpolate;
4464 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4465 ConstantString(property),ConstantString(value));
4471 if (LocaleCompare(
"loop",property) == 0)
4473 image->iterations=StringToUnsignedLong(value);
4476 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4477 ConstantString(property),ConstantString(value));
4483 if (LocaleCompare(
"page",property) == 0)
4488 geometry=GetPageGeometry(value);
4489 flags=ParseAbsoluteGeometry(geometry,&image->page);
4490 geometry=DestroyString(geometry);
4493 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4494 ConstantString(property),ConstantString(value));
4500 if (LocaleCompare(
"rendering-intent",property) == 0)
4505 rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse,
4507 if (rendering_intent < 0)
4509 image->rendering_intent=(RenderingIntent) rendering_intent;
4512 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4513 ConstantString(property),ConstantString(value));
4519 if (LocaleCompare(
"tile-offset",property) == 0)
4524 geometry=GetPageGeometry(value);
4525 flags=ParseAbsoluteGeometry(geometry,&image->tile_offset);
4526 geometry=DestroyString(geometry);
4529 if (LocaleCompare(
"type",property) == 0)
4534 type=ParseCommandOption(MagickTypeOptions,MagickFalse,value);
4536 return(MagickFalse);
4537 image->type=(ImageType) type;
4540 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4541 ConstantString(property),ConstantString(value));
4547 if (LocaleCompare(
"units",property) == 0)
4552 units=ParseCommandOption(MagickResolutionOptions,MagickFalse,value);
4555 image->units=(ResolutionType) units;
4558 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4559 ConstantString(property),ConstantString(value));
4564 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4565 ConstantString(property),ConstantString(value));