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
130MagickExport 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);
228MagickExport 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));
275MagickExport 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));
310MagickExport
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 *)
350MagickExport 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,
407static 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);
472static inline int ReadPropertyByte(
const unsigned char **p,
size_t *length)
484static 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);
524static 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);
562static 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);
713static 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);
745static 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);
766static 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);
794static 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);
811static MagickBooleanType GetEXIFProperty(
const Image *image,
812 const char *property)
814#define MaxDirectoryStack 16
815#define EXIF_DELIMITER "\n"
816#define EXIF_NUM_FORMATS 12
817#define EXIF_FMT_BYTE 1
818#define EXIF_FMT_STRING 2
819#define EXIF_FMT_USHORT 3
820#define EXIF_FMT_ULONG 4
821#define EXIF_FMT_URATIONAL 5
822#define EXIF_FMT_SBYTE 6
823#define EXIF_FMT_UNDEFINED 7
824#define EXIF_FMT_SSHORT 8
825#define EXIF_FMT_SLONG 9
826#define EXIF_FMT_SRATIONAL 10
827#define EXIF_FMT_SINGLE 11
828#define EXIF_FMT_DOUBLE 12
829#define GPS_LATITUDE 0x10002
830#define GPS_LONGITUDE 0x10004
831#define GPS_TIMESTAMP 0x10007
832#define TAG_EXIF_OFFSET 0x8769
833#define TAG_GPS_OFFSET 0x8825
834#define TAG_INTEROP_OFFSET 0xa005
837#define EXIFGPSFractions(format,arg1,arg2,arg3,arg4,arg5,arg6) \
845 for ( ; component < components; component++) \
847 if (component != 0) \
848 extent+=(size_t) FormatLocaleString(buffer+extent,MagickPathExtent- \
850 extent+=(size_t) FormatLocaleString(buffer+extent,MagickPathExtent- \
851 extent,format,(arg1),(arg2),(arg3),(arg4),(arg5),(arg6)); \
852 if (extent >= (MagickPathExtent-1)) \
853 extent=MagickPathExtent-1; \
855 buffer[extent]='\0'; \
856 value=AcquireString(buffer); \
859#define EXIFMultipleValues(format,arg) \
867 for ( ; component < components; component++) \
869 if (component != 0) \
870 extent+=(size_t) FormatLocaleString(buffer+extent,MagickPathExtent- \
872 extent+=(size_t) FormatLocaleString(buffer+extent,MagickPathExtent- \
873 extent,format,arg); \
874 if (extent >= (MagickPathExtent-1)) \
875 extent=MagickPathExtent-1; \
877 buffer[extent]='\0'; \
878 value=AcquireString(buffer); \
881#define EXIFMultipleFractions(format,arg1,arg2) \
889 for ( ; component < components; component++) \
891 if (component != 0) \
892 extent+=(size_t) FormatLocaleString(buffer+extent,MagickPathExtent-\
894 extent+=(size_t) FormatLocaleString(buffer+extent,MagickPathExtent- \
895 extent,format,(arg1),(arg2)); \
896 if (extent >= (MagickPathExtent-1)) \
897 extent=MagickPathExtent-1; \
899 buffer[extent]='\0'; \
900 value=AcquireString(buffer); \
903 typedef struct _DirectoryInfo
915 typedef struct _TagInfo
927 { 0x001,
"exif:InteroperabilityIndex" },
928 { 0x002,
"exif:InteroperabilityVersion" },
929 { 0x100,
"exif:ImageWidth" },
930 { 0x101,
"exif:ImageLength" },
931 { 0x102,
"exif:BitsPerSample" },
932 { 0x103,
"exif:Compression" },
933 { 0x106,
"exif:PhotometricInterpretation" },
934 { 0x10a,
"exif:FillOrder" },
935 { 0x10d,
"exif:DocumentName" },
936 { 0x10e,
"exif:ImageDescription" },
937 { 0x10f,
"exif:Make" },
938 { 0x110,
"exif:Model" },
939 { 0x111,
"exif:StripOffsets" },
940 { 0x112,
"exif:Orientation" },
941 { 0x115,
"exif:SamplesPerPixel" },
942 { 0x116,
"exif:RowsPerStrip" },
943 { 0x117,
"exif:StripByteCounts" },
944 { 0x11a,
"exif:XResolution" },
945 { 0x11b,
"exif:YResolution" },
946 { 0x11c,
"exif:PlanarConfiguration" },
947 { 0x11d,
"exif:PageName" },
948 { 0x11e,
"exif:XPosition" },
949 { 0x11f,
"exif:YPosition" },
950 { 0x118,
"exif:MinSampleValue" },
951 { 0x119,
"exif:MaxSampleValue" },
952 { 0x120,
"exif:FreeOffsets" },
953 { 0x121,
"exif:FreeByteCounts" },
954 { 0x122,
"exif:GrayResponseUnit" },
955 { 0x123,
"exif:GrayResponseCurve" },
956 { 0x124,
"exif:T4Options" },
957 { 0x125,
"exif:T6Options" },
958 { 0x128,
"exif:ResolutionUnit" },
959 { 0x12d,
"exif:TransferFunction" },
960 { 0x131,
"exif:Software" },
961 { 0x132,
"exif:DateTime" },
962 { 0x13b,
"exif:Artist" },
963 { 0x13e,
"exif:WhitePoint" },
964 { 0x13f,
"exif:PrimaryChromaticities" },
965 { 0x140,
"exif:ColorMap" },
966 { 0x141,
"exif:HalfToneHints" },
967 { 0x142,
"exif:TileWidth" },
968 { 0x143,
"exif:TileLength" },
969 { 0x144,
"exif:TileOffsets" },
970 { 0x145,
"exif:TileByteCounts" },
971 { 0x14a,
"exif:SubIFD" },
972 { 0x14c,
"exif:InkSet" },
973 { 0x14d,
"exif:InkNames" },
974 { 0x14e,
"exif:NumberOfInks" },
975 { 0x150,
"exif:DotRange" },
976 { 0x151,
"exif:TargetPrinter" },
977 { 0x152,
"exif:ExtraSample" },
978 { 0x153,
"exif:SampleFormat" },
979 { 0x154,
"exif:SMinSampleValue" },
980 { 0x155,
"exif:SMaxSampleValue" },
981 { 0x156,
"exif:TransferRange" },
982 { 0x157,
"exif:ClipPath" },
983 { 0x158,
"exif:XClipPathUnits" },
984 { 0x159,
"exif:YClipPathUnits" },
985 { 0x15a,
"exif:Indexed" },
986 { 0x15b,
"exif:JPEGTables" },
987 { 0x15f,
"exif:OPIProxy" },
988 { 0x200,
"exif:JPEGProc" },
989 { 0x201,
"exif:JPEGInterchangeFormat" },
990 { 0x202,
"exif:JPEGInterchangeFormatLength" },
991 { 0x203,
"exif:JPEGRestartInterval" },
992 { 0x205,
"exif:JPEGLosslessPredictors" },
993 { 0x206,
"exif:JPEGPointTransforms" },
994 { 0x207,
"exif:JPEGQTables" },
995 { 0x208,
"exif:JPEGDCTables" },
996 { 0x209,
"exif:JPEGACTables" },
997 { 0x211,
"exif:YCbCrCoefficients" },
998 { 0x212,
"exif:YCbCrSubSampling" },
999 { 0x213,
"exif:YCbCrPositioning" },
1000 { 0x214,
"exif:ReferenceBlackWhite" },
1001 { 0x2bc,
"exif:ExtensibleMetadataPlatform" },
1002 { 0x301,
"exif:Gamma" },
1003 { 0x302,
"exif:ICCProfileDescriptor" },
1004 { 0x303,
"exif:SRGBRenderingIntent" },
1005 { 0x320,
"exif:ImageTitle" },
1006 { 0x5001,
"exif:ResolutionXUnit" },
1007 { 0x5002,
"exif:ResolutionYUnit" },
1008 { 0x5003,
"exif:ResolutionXLengthUnit" },
1009 { 0x5004,
"exif:ResolutionYLengthUnit" },
1010 { 0x5005,
"exif:PrintFlags" },
1011 { 0x5006,
"exif:PrintFlagsVersion" },
1012 { 0x5007,
"exif:PrintFlagsCrop" },
1013 { 0x5008,
"exif:PrintFlagsBleedWidth" },
1014 { 0x5009,
"exif:PrintFlagsBleedWidthScale" },
1015 { 0x500A,
"exif:HalftoneLPI" },
1016 { 0x500B,
"exif:HalftoneLPIUnit" },
1017 { 0x500C,
"exif:HalftoneDegree" },
1018 { 0x500D,
"exif:HalftoneShape" },
1019 { 0x500E,
"exif:HalftoneMisc" },
1020 { 0x500F,
"exif:HalftoneScreen" },
1021 { 0x5010,
"exif:JPEGQuality" },
1022 { 0x5011,
"exif:GridSize" },
1023 { 0x5012,
"exif:ThumbnailFormat" },
1024 { 0x5013,
"exif:ThumbnailWidth" },
1025 { 0x5014,
"exif:ThumbnailHeight" },
1026 { 0x5015,
"exif:ThumbnailColorDepth" },
1027 { 0x5016,
"exif:ThumbnailPlanes" },
1028 { 0x5017,
"exif:ThumbnailRawBytes" },
1029 { 0x5018,
"exif:ThumbnailSize" },
1030 { 0x5019,
"exif:ThumbnailCompressedSize" },
1031 { 0x501a,
"exif:ColorTransferFunction" },
1032 { 0x501b,
"exif:ThumbnailData" },
1033 { 0x5020,
"exif:ThumbnailImageWidth" },
1034 { 0x5021,
"exif:ThumbnailImageHeight" },
1035 { 0x5022,
"exif:ThumbnailBitsPerSample" },
1036 { 0x5023,
"exif:ThumbnailCompression" },
1037 { 0x5024,
"exif:ThumbnailPhotometricInterp" },
1038 { 0x5025,
"exif:ThumbnailImageDescription" },
1039 { 0x5026,
"exif:ThumbnailEquipMake" },
1040 { 0x5027,
"exif:ThumbnailEquipModel" },
1041 { 0x5028,
"exif:ThumbnailStripOffsets" },
1042 { 0x5029,
"exif:ThumbnailOrientation" },
1043 { 0x502a,
"exif:ThumbnailSamplesPerPixel" },
1044 { 0x502b,
"exif:ThumbnailRowsPerStrip" },
1045 { 0x502c,
"exif:ThumbnailStripBytesCount" },
1046 { 0x502d,
"exif:ThumbnailResolutionX" },
1047 { 0x502e,
"exif:ThumbnailResolutionY" },
1048 { 0x502f,
"exif:ThumbnailPlanarConfig" },
1049 { 0x5030,
"exif:ThumbnailResolutionUnit" },
1050 { 0x5031,
"exif:ThumbnailTransferFunction" },
1051 { 0x5032,
"exif:ThumbnailSoftwareUsed" },
1052 { 0x5033,
"exif:ThumbnailDateTime" },
1053 { 0x5034,
"exif:ThumbnailArtist" },
1054 { 0x5035,
"exif:ThumbnailWhitePoint" },
1055 { 0x5036,
"exif:ThumbnailPrimaryChromaticities" },
1056 { 0x5037,
"exif:ThumbnailYCbCrCoefficients" },
1057 { 0x5038,
"exif:ThumbnailYCbCrSubsampling" },
1058 { 0x5039,
"exif:ThumbnailYCbCrPositioning" },
1059 { 0x503A,
"exif:ThumbnailRefBlackWhite" },
1060 { 0x503B,
"exif:ThumbnailCopyRight" },
1061 { 0x5090,
"exif:LuminanceTable" },
1062 { 0x5091,
"exif:ChrominanceTable" },
1063 { 0x5100,
"exif:FrameDelay" },
1064 { 0x5101,
"exif:LoopCount" },
1065 { 0x5110,
"exif:PixelUnit" },
1066 { 0x5111,
"exif:PixelPerUnitX" },
1067 { 0x5112,
"exif:PixelPerUnitY" },
1068 { 0x5113,
"exif:PaletteHistogram" },
1069 { 0x1000,
"exif:RelatedImageFileFormat" },
1070 { 0x1001,
"exif:RelatedImageLength" },
1071 { 0x1002,
"exif:RelatedImageWidth" },
1072 { 0x800d,
"exif:ImageID" },
1073 { 0x80e3,
"exif:Matteing" },
1074 { 0x80e4,
"exif:DataType" },
1075 { 0x80e5,
"exif:ImageDepth" },
1076 { 0x80e6,
"exif:TileDepth" },
1077 { 0x828d,
"exif:CFARepeatPatternDim" },
1078 { 0x828e,
"exif:CFAPattern2" },
1079 { 0x828f,
"exif:BatteryLevel" },
1080 { 0x8298,
"exif:Copyright" },
1081 { 0x829a,
"exif:ExposureTime" },
1082 { 0x829d,
"exif:FNumber" },
1083 { 0x83bb,
"exif:IPTC/NAA" },
1084 { 0x84e3,
"exif:IT8RasterPadding" },
1085 { 0x84e5,
"exif:IT8ColorTable" },
1086 { 0x8649,
"exif:ImageResourceInformation" },
1087 { 0x8769,
"exif:ExifOffset" },
1088 { 0x8773,
"exif:InterColorProfile" },
1089 { 0x8822,
"exif:ExposureProgram" },
1090 { 0x8824,
"exif:SpectralSensitivity" },
1091 { 0x8825,
"exif:GPSInfo" },
1092 { 0x8827,
"exif:PhotographicSensitivity" },
1093 { 0x8828,
"exif:OECF" },
1094 { 0x8829,
"exif:Interlace" },
1095 { 0x882a,
"exif:TimeZoneOffset" },
1096 { 0x882b,
"exif:SelfTimerMode" },
1097 { 0x8830,
"exif:SensitivityType" },
1098 { 0x8831,
"exif:StandardOutputSensitivity" },
1099 { 0x8832,
"exif:RecommendedExposureIndex" },
1100 { 0x8833,
"exif:ISOSpeed" },
1101 { 0x8834,
"exif:ISOSpeedLatitudeyyy" },
1102 { 0x8835,
"exif:ISOSpeedLatitudezzz" },
1103 { 0x9000,
"exif:ExifVersion" },
1104 { 0x9003,
"exif:DateTimeOriginal" },
1105 { 0x9004,
"exif:DateTimeDigitized" },
1106 { 0x9010,
"exif:OffsetTime" },
1107 { 0x9011,
"exif:OffsetTimeOriginal" },
1108 { 0x9012,
"exif:OffsetTimeDigitized" },
1109 { 0x9101,
"exif:ComponentsConfiguration" },
1110 { 0x9102,
"exif:CompressedBitsPerPixel" },
1111 { 0x9201,
"exif:ShutterSpeedValue" },
1112 { 0x9202,
"exif:ApertureValue" },
1113 { 0x9203,
"exif:BrightnessValue" },
1114 { 0x9204,
"exif:ExposureBiasValue" },
1115 { 0x9205,
"exif:MaxApertureValue" },
1116 { 0x9206,
"exif:SubjectDistance" },
1117 { 0x9207,
"exif:MeteringMode" },
1118 { 0x9208,
"exif:LightSource" },
1119 { 0x9209,
"exif:Flash" },
1120 { 0x920a,
"exif:FocalLength" },
1121 { 0x920b,
"exif:FlashEnergy" },
1122 { 0x920c,
"exif:SpatialFrequencyResponse" },
1123 { 0x920d,
"exif:Noise" },
1124 { 0x9214,
"exif:SubjectArea" },
1125 { 0x9290,
"exif:SubSecTime" },
1126 { 0x9291,
"exif:SubSecTimeOriginal" },
1127 { 0x9292,
"exif:SubSecTimeDigitized" },
1128 { 0x9211,
"exif:ImageNumber" },
1129 { 0x9212,
"exif:SecurityClassification" },
1130 { 0x9213,
"exif:ImageHistory" },
1131 { 0x9214,
"exif:SubjectArea" },
1132 { 0x9215,
"exif:ExposureIndex" },
1133 { 0x9216,
"exif:TIFF-EPStandardID" },
1134 { 0x927c,
"exif:MakerNote" },
1135 { 0x9286,
"exif:UserComment" },
1136 { 0x9290,
"exif:SubSecTime" },
1137 { 0x9291,
"exif:SubSecTimeOriginal" },
1138 { 0x9292,
"exif:SubSecTimeDigitized" },
1139 { 0x9400,
"exif:Temperature" },
1140 { 0x9401,
"exif:Humidity" },
1141 { 0x9402,
"exif:Pressure" },
1142 { 0x9403,
"exif:WaterDepth" },
1143 { 0x9404,
"exif:Acceleration" },
1144 { 0x9405,
"exif:CameraElevationAngle" },
1145 { 0x9C9b,
"exif:WinXP-Title" },
1146 { 0x9C9c,
"exif:WinXP-Comments" },
1147 { 0x9C9d,
"exif:WinXP-Author" },
1148 { 0x9C9e,
"exif:WinXP-Keywords" },
1149 { 0x9C9f,
"exif:WinXP-Subject" },
1150 { 0xa000,
"exif:FlashPixVersion" },
1151 { 0xa001,
"exif:ColorSpace" },
1152 { 0xa002,
"exif:PixelXDimension" },
1153 { 0xa003,
"exif:PixelYDimension" },
1154 { 0xa004,
"exif:RelatedSoundFile" },
1155 { 0xa005,
"exif:InteroperabilityOffset" },
1156 { 0xa20b,
"exif:FlashEnergy" },
1157 { 0xa20c,
"exif:SpatialFrequencyResponse" },
1158 { 0xa20d,
"exif:Noise" },
1159 { 0xa20e,
"exif:FocalPlaneXResolution" },
1160 { 0xa20f,
"exif:FocalPlaneYResolution" },
1161 { 0xa210,
"exif:FocalPlaneResolutionUnit" },
1162 { 0xa214,
"exif:SubjectLocation" },
1163 { 0xa215,
"exif:ExposureIndex" },
1164 { 0xa216,
"exif:TIFF/EPStandardID" },
1165 { 0xa217,
"exif:SensingMethod" },
1166 { 0xa300,
"exif:FileSource" },
1167 { 0xa301,
"exif:SceneType" },
1168 { 0xa302,
"exif:CFAPattern" },
1169 { 0xa401,
"exif:CustomRendered" },
1170 { 0xa402,
"exif:ExposureMode" },
1171 { 0xa403,
"exif:WhiteBalance" },
1172 { 0xa404,
"exif:DigitalZoomRatio" },
1173 { 0xa405,
"exif:FocalLengthIn35mmFilm" },
1174 { 0xa406,
"exif:SceneCaptureType" },
1175 { 0xa407,
"exif:GainControl" },
1176 { 0xa408,
"exif:Contrast" },
1177 { 0xa409,
"exif:Saturation" },
1178 { 0xa40a,
"exif:Sharpness" },
1179 { 0xa40b,
"exif:DeviceSettingDescription" },
1180 { 0xa40c,
"exif:SubjectDistanceRange" },
1181 { 0xa420,
"exif:ImageUniqueID" },
1182 { 0xa430,
"exif:CameraOwnerName" },
1183 { 0xa431,
"exif:BodySerialNumber" },
1184 { 0xa432,
"exif:LensSpecification" },
1185 { 0xa433,
"exif:LensMake" },
1186 { 0xa434,
"exif:LensModel" },
1187 { 0xa435,
"exif:LensSerialNumber" },
1188 { 0xc4a5,
"exif:PrintImageMatching" },
1189 { 0xa500,
"exif:Gamma" },
1190 { 0xc640,
"exif:CR2Slice" },
1191 { 0x10000,
"exif:GPSVersionID" },
1192 { 0x10001,
"exif:GPSLatitudeRef" },
1193 { 0x10002,
"exif:GPSLatitude" },
1194 { 0x10003,
"exif:GPSLongitudeRef" },
1195 { 0x10004,
"exif:GPSLongitude" },
1196 { 0x10005,
"exif:GPSAltitudeRef" },
1197 { 0x10006,
"exif:GPSAltitude" },
1198 { 0x10007,
"exif:GPSTimeStamp" },
1199 { 0x10008,
"exif:GPSSatellites" },
1200 { 0x10009,
"exif:GPSStatus" },
1201 { 0x1000a,
"exif:GPSMeasureMode" },
1202 { 0x1000b,
"exif:GPSDop" },
1203 { 0x1000c,
"exif:GPSSpeedRef" },
1204 { 0x1000d,
"exif:GPSSpeed" },
1205 { 0x1000e,
"exif:GPSTrackRef" },
1206 { 0x1000f,
"exif:GPSTrack" },
1207 { 0x10010,
"exif:GPSImgDirectionRef" },
1208 { 0x10011,
"exif:GPSImgDirection" },
1209 { 0x10012,
"exif:GPSMapDatum" },
1210 { 0x10013,
"exif:GPSDestLatitudeRef" },
1211 { 0x10014,
"exif:GPSDestLatitude" },
1212 { 0x10015,
"exif:GPSDestLongitudeRef" },
1213 { 0x10016,
"exif:GPSDestLongitude" },
1214 { 0x10017,
"exif:GPSDestBearingRef" },
1215 { 0x10018,
"exif:GPSDestBearing" },
1216 { 0x10019,
"exif:GPSDestDistanceRef" },
1217 { 0x1001a,
"exif:GPSDestDistance" },
1218 { 0x1001b,
"exif:GPSProcessingMethod" },
1219 { 0x1001c,
"exif:GPSAreaInformation" },
1220 { 0x1001d,
"exif:GPSDateStamp" },
1221 { 0x1001e,
"exif:GPSDifferential" },
1222 { 0x1001f,
"exif:GPSHPositioningError" },
1234 directory_stack[MaxDirectoryStack] = { { 0, 0, 0 } };
1263 tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
1268 profile=GetImageProfile(image,
"exif");
1270 return(MagickFalse);
1271 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1272 return(MagickFalse);
1273 while (isspace((
int) ((
unsigned char) *property)) != 0)
1275 if (strlen(property) <= 5)
1276 return(MagickFalse);
1279 switch (*(property+5))
1308 tag=(*(
property+5) ==
'@') ? 1UL : 0UL;
1312 return(MagickFalse);
1319 for (i=(ssize_t) n-1L; i >= 0; i--)
1323 if ((c >=
'0') && (c <=
'9'))
1326 if ((c >=
'A') && (c <=
'F'))
1329 if ((c >=
'a') && (c <=
'f'))
1332 return(MagickFalse);
1334 }
while (*property !=
'\0');
1344 if (EXIFTag[i].tag == 0)
1346 if (LocaleCompare(EXIFTag[i].description,property) == 0)
1348 tag=(size_t) EXIFTag[i].tag;
1356 return(MagickFalse);
1357 length=GetStringInfoLength(profile);
1359 return(MagickFalse);
1360 exif=GetStringInfoDatum(profile);
1363 if (ReadPropertyByte(&exif,&length) != 0x45)
1365 if (ReadPropertyByte(&exif,&length) != 0x78)
1367 if (ReadPropertyByte(&exif,&length) != 0x69)
1369 if (ReadPropertyByte(&exif,&length) != 0x66)
1371 if (ReadPropertyByte(&exif,&length) != 0x00)
1373 if (ReadPropertyByte(&exif,&length) != 0x00)
1378 return(MagickFalse);
1379 id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif);
1387 return(MagickFalse);
1388 if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a)
1389 return(MagickFalse);
1393 offset=(ssize_t) ReadPropertySignedLong(endian,exif+4);
1394 if ((offset < 0) || (
size_t) offset >= length)
1395 return(MagickFalse);
1400 directory=exif+offset;
1404 exif_resources=NewSplayTree((
int (*)(
const void *,
const void *)) NULL,
1405 (
void *(*)(
void *)) NULL,(
void *(*)(
void *)) NULL);
1414 directory=directory_stack[level].directory;
1415 entry=directory_stack[level].entry;
1416 tag_offset=directory_stack[level].offset;
1418 if ((directory < exif) || (directory > (exif+length-2)))
1423 number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory);
1424 for ( ; entry < number_entries; entry++)
1437 q=(
unsigned char *) (directory+(12*entry)+2);
1438 if (q > (exif+length-12))
1440 if (GetValueFromSplayTree(exif_resources,q) == q)
1442 (void) AddValueToSplayTree(exif_resources,q,q);
1443 tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset;
1444 format=(size_t) ReadPropertyUnsignedShort(endian,q+2);
1445 if (format >= (
sizeof(tag_bytes)/
sizeof(*tag_bytes)))
1449 components=(ssize_t) ReadPropertySignedLong(endian,q+4);
1452 number_bytes=(size_t) components*tag_bytes[format];
1453 if (number_bytes < components)
1455 if (number_bytes <= 4)
1465 dir_offset=(ssize_t) ReadPropertySignedLong(endian,q+8);
1466 if ((dir_offset < 0) || (
size_t) dir_offset >= length)
1468 if (((
size_t) dir_offset+number_bytes) < (
size_t) dir_offset)
1470 if (((
size_t) dir_offset+number_bytes) > length)
1472 p=(
unsigned char *) (exif+dir_offset);
1474 if ((all != 0) || (tag == (
size_t) tag_value))
1477 buffer[6*
sizeof(double)+MaxTextExtent],
1480 if ((p < exif) || (p > (exif+length-tag_bytes[format])))
1482 value=(
char *) NULL;
1488 value=(
char *) NULL;
1489 if (~((
size_t) number_bytes) >= 1)
1490 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1492 if (value != (
char *) NULL)
1494 for (i=0; i < (ssize_t) number_bytes; i++)
1497 if (isprint((
int) p[i]) != 0)
1498 value[i]=(char) p[i];
1504 case EXIF_FMT_SBYTE:
1506 EXIFMultipleValues(
"%.20g",(
double) (*(
signed char *) p));
1509 case EXIF_FMT_SSHORT:
1511 EXIFMultipleValues(
"%hd",ReadPropertySignedShort(endian,p));
1514 case EXIF_FMT_USHORT:
1516 EXIFMultipleValues(
"%hu",ReadPropertyUnsignedShort(endian,p));
1519 case EXIF_FMT_ULONG:
1521 EXIFMultipleValues(
"%.20g",(
double)
1522 ReadPropertyUnsignedLong(endian,p));
1525 case EXIF_FMT_SLONG:
1527 EXIFMultipleValues(
"%.20g",(
double)
1528 ReadPropertySignedLong(endian,p));
1531 case EXIF_FMT_URATIONAL:
1533 if ((tag_value == GPS_LATITUDE) || (tag_value == GPS_LONGITUDE) ||
1534 (tag_value == GPS_TIMESTAMP))
1537 EXIFGPSFractions(
"%.20g/%.20g,%.20g/%.20g,%.20g/%.20g",
1538 (
double) ReadPropertyUnsignedLong(endian,p),
1539 (
double) ReadPropertyUnsignedLong(endian,p+4),
1540 (
double) ReadPropertyUnsignedLong(endian,p+8),
1541 (
double) ReadPropertyUnsignedLong(endian,p+12),
1542 (
double) ReadPropertyUnsignedLong(endian,p+16),
1543 (
double) ReadPropertyUnsignedLong(endian,p+20));
1546 EXIFMultipleFractions(
"%.20g/%.20g",(
double)
1547 ReadPropertyUnsignedLong(endian,p),(
double)
1548 ReadPropertyUnsignedLong(endian,p+4));
1551 case EXIF_FMT_SRATIONAL:
1553 EXIFMultipleFractions(
"%.20g/%.20g",(
double)
1554 ReadPropertySignedLong(endian,p),(
double)
1555 ReadPropertySignedLong(endian,p+4));
1558 case EXIF_FMT_SINGLE:
1560 EXIFMultipleValues(
"%.20g",(
double)
1561 ReadPropertySignedLong(endian,p));
1564 case EXIF_FMT_DOUBLE:
1566 EXIFMultipleValues(
"%.20g",(
double)
1567 ReadPropertySignedLong(endian,p));
1570 case EXIF_FMT_STRING:
1571 case EXIF_FMT_UNDEFINED:
1574 if ((p < exif) || (p > (exif+length-number_bytes)))
1576 value=(
char *) NULL;
1577 if (~((
size_t) number_bytes) >= 1)
1578 value=(
char *) AcquireQuantumMemory((
size_t) number_bytes+1UL,
1580 if (value != (
char *) NULL)
1585 for (i=0; i < (ssize_t) number_bytes; i++)
1588 if ((isprint((
int) p[i]) != 0) || (p[i] ==
'\0'))
1589 value[i]=(char) p[i];
1596 if (value != (
char *) NULL)
1604 key=AcquireString(property);
1615 description=
"unknown";
1618 if (EXIFTag[i].tag == 0)
1620 if (EXIFTag[i].tag == tag_value)
1622 description=EXIFTag[i].description;
1626 (void) FormatLocaleString(key,MaxTextExtent,
"%s",
1629 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1634 if (tag_value < 0x10000)
1635 (void) FormatLocaleString(key,MaxTextExtent,
"#%04lx",
1636 (
unsigned long) tag_value);
1638 if (tag_value < 0x20000)
1639 (void) FormatLocaleString(key,MaxTextExtent,
"@%04lx",
1640 (
unsigned long) (tag_value & 0xffff));
1642 (
void) FormatLocaleString(key,MaxTextExtent,
"unknown");
1648 (void) SubstituteString(&key,
"exif:",
"exif:thumbnail:");
1651 p=(
const char *) NULL;
1652 if (image->properties != (
void *) NULL)
1654 image->properties,key);
1655 if (p == (
const char *) NULL)
1656 (void) SetImageProperty((
Image *) image,key,value);
1657 value=DestroyString(value);
1658 key=DestroyString(key);
1662 if ((tag_value == TAG_EXIF_OFFSET) ||
1663 (tag_value == TAG_INTEROP_OFFSET) || (tag_value == TAG_GPS_OFFSET))
1668 offset=(ssize_t) ReadPropertySignedLong(endian,p);
1669 if (((
size_t) offset < length) && (level < (MaxDirectoryStack-2)))
1674 tag_offset1=(ssize_t) ((tag_value == TAG_GPS_OFFSET) ? 0x10000 :
1676 directory_stack[level].directory=directory;
1678 directory_stack[level].entry=entry;
1679 directory_stack[level].offset=tag_offset;
1684 for (i=0; i < level; i++)
1685 if (directory_stack[i].directory == (exif+tag_offset1))
1689 directory_stack[level].directory=exif+offset;
1690 directory_stack[level].offset=tag_offset1;
1691 directory_stack[level].entry=0;
1693 if ((directory+2+(12*number_entries)+4) > (exif+length))
1695 offset=(ssize_t) ReadPropertySignedLong(endian,directory+2+(12*
1697 if ((offset != 0) && ((
size_t) offset < length) &&
1698 (level < (MaxDirectoryStack-2)))
1700 directory_stack[level].directory=exif+offset;
1701 directory_stack[level].entry=0;
1702 directory_stack[level].offset=tag_offset1;
1709 }
while (level > 0);
1710 exif_resources=DestroySplayTree(exif_resources);
1714static MagickBooleanType GetICCProperty(
const Image *image)
1722 profile=GetImageProfile(image,
"icc");
1724 profile=GetImageProfile(image,
"icm");
1726 return(MagickFalse);
1727 if (GetStringInfoLength(profile) < 128)
1728 return(MagickFalse);
1729#if defined(MAGICKCORE_LCMS_DELEGATE)
1734 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
1735 (cmsUInt32Number) GetStringInfoLength(profile));
1736 if (icc_profile != (cmsHPROFILE *) NULL)
1738#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
1742 name=cmsTakeProductName(icc_profile);
1743 if (name != (
const char *) NULL)
1744 (void) SetImageProperty((
Image *) image,
"icc:name",name);
1752 info=AcquireStringInfo(0);
1753 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
"US",
1757 SetStringInfoLength(info,extent+1);
1758 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
"en",
1759 "US",(
char *) GetStringInfoDatum(info),extent);
1761 (void) SetImageProperty((
Image *) image,
"icc:description",
1762 (
char *) GetStringInfoDatum(info));
1764 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
"US",
1768 SetStringInfoLength(info,extent+1);
1769 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
"en",
1770 "US",(
char *) GetStringInfoDatum(info),extent);
1772 (void) SetImageProperty((
Image *) image,
"icc:manufacturer",
1773 (
char *) GetStringInfoDatum(info));
1775 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1779 SetStringInfoLength(info,extent+1);
1780 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,
"en",
"US",
1781 (
char *) GetStringInfoDatum(info),extent);
1783 (void) SetImageProperty((
Image *) image,
"icc:model",
1784 (
char *) GetStringInfoDatum(info));
1786 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
"US",
1790 SetStringInfoLength(info,extent+1);
1791 extent=cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
"en",
1792 "US",(
char *) GetStringInfoDatum(info),extent);
1794 (void) SetImageProperty((
Image *) image,
"icc:copyright",
1795 (
char *) GetStringInfoDatum(info));
1797 info=DestroyStringInfo(info);
1799 (void) cmsCloseProfile(icc_profile);
1806static MagickBooleanType SkipXMPValue(
const char *value)
1808 if (value == (
const char*) NULL)
1810 while (*value !=
'\0')
1812 if (isspace((
int) ((
unsigned char) *value)) == 0)
1813 return(MagickFalse);
1819static MagickBooleanType GetXMPProperty(
const Image *image,
const char *property)
1846 profile=GetImageProfile(image,
"xmp");
1848 return(MagickFalse);
1849 if (GetStringInfoLength(profile) < 17)
1850 return(MagickFalse);
1851 if ((property == (
const char *) NULL) || (*property ==
'\0'))
1852 return(MagickFalse);
1853 xmp_profile=StringInfoToString(profile);
1854 if (xmp_profile == (
char *) NULL)
1855 return(MagickFalse);
1856 for (p=xmp_profile; *p !=
'\0'; p++)
1857 if ((*p ==
'<') && (*(p+1) ==
'x'))
1859 exception=AcquireExceptionInfo();
1860 xmp=NewXMLTree((
char *) p,exception);
1861 xmp_profile=DestroyString(xmp_profile);
1862 exception=DestroyExceptionInfo(exception);
1864 return(MagickFalse);
1866 rdf=GetXMLTreeChild(xmp,
"rdf:RDF");
1869 if (image->properties == (
void *) NULL)
1870 ((
Image *) image)->properties=NewSplayTree(CompareSplayTreeString,
1871 RelinquishMagickMemory,RelinquishMagickMemory);
1872 description=GetXMLTreeChild(rdf,
"rdf:Description");
1875 node=GetXMLTreeChild(description,(
const char *) NULL);
1881 child=GetXMLTreeChild(node,(
const char *) NULL);
1882 content=GetXMLTreeContent(node);
1884 (SkipXMPValue(content) == MagickFalse))
1886 xmp_namespace=ConstantString(GetXMLTreeTag(node));
1887 (void) SubstituteString(&xmp_namespace,
"exif:",
"xmp:");
1888 (void) AddValueToSplayTree((
SplayTreeInfo *) image->properties,
1889 xmp_namespace,ConstantString(content));
1893 content=GetXMLTreeContent(child);
1894 if (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));
1901 child=GetXMLTreeSibling(child);
1903 node=GetXMLTreeSibling(node);
1905 description=GetNextXMLTreeTag(description);
1908 xmp=DestroyXMLTree(xmp);
1912static char *TracePSClippath(
const unsigned char *blob,
size_t length,
1913 const size_t magick_unused(columns),
const size_t magick_unused(rows))
1936 magick_unreferenced(columns);
1937 magick_unreferenced(rows);
1939 path=AcquireString((
char *) NULL);
1940 if (path == (
char *) NULL)
1941 return((
char *) NULL);
1942 message=AcquireString((
char *) NULL);
1943 (void) FormatLocaleString(message,MaxTextExtent,
"/ClipImage\n");
1944 (void) ConcatenateString(&path,message);
1945 (void) FormatLocaleString(message,MaxTextExtent,
"{\n");
1946 (void) ConcatenateString(&path,message);
1947 (void) FormatLocaleString(message,MaxTextExtent,
" /c {curveto} bind def\n");
1948 (void) ConcatenateString(&path,message);
1949 (void) FormatLocaleString(message,MaxTextExtent,
" /l {lineto} bind def\n");
1950 (void) ConcatenateString(&path,message);
1951 (void) FormatLocaleString(message,MaxTextExtent,
" /m {moveto} bind def\n");
1952 (void) ConcatenateString(&path,message);
1953 (void) FormatLocaleString(message,MaxTextExtent,
1954 " /v {currentpoint 6 2 roll curveto} bind def\n");
1955 (void) ConcatenateString(&path,message);
1956 (void) FormatLocaleString(message,MaxTextExtent,
1957 " /y {2 copy curveto} bind def\n");
1958 (void) ConcatenateString(&path,message);
1959 (void) FormatLocaleString(message,MaxTextExtent,
1960 " /z {closepath} bind def\n");
1961 (void) ConcatenateString(&path,message);
1962 (void) FormatLocaleString(message,MaxTextExtent,
" newpath\n");
1963 (void) ConcatenateString(&path,message);
1968 (void) memset(point,0,
sizeof(point));
1969 (void) memset(first,0,
sizeof(first));
1970 (void) memset(last,0,
sizeof(last));
1972 in_subpath=MagickFalse;
1975 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
1981 if (knot_count != 0)
1984 length-=MagickMin(24,(ssize_t) length);
1990 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
1992 length-=MagickMin(22,(ssize_t) length);
2000 if (knot_count == 0)
2006 length-=MagickMin(24,(ssize_t) length);
2012 for (i=0; i < 3; i++)
2014 y=(size_t) ReadPropertyMSBLong(&blob,&length);
2015 x=(size_t) ReadPropertyMSBLong(&blob,&length);
2016 point[i].x=(double) x/4096.0/4096.0;
2017 point[i].y=1.0-(double) y/4096.0/4096.0;
2019 if (in_subpath == MagickFalse)
2021 (void) FormatLocaleString(message,MaxTextExtent,
" %g %g m\n",
2022 point[1].x,point[1].y);
2023 for (i=0; i < 3; i++)
2035 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2036 (point[0].x == point[1].x) && (point[0].y == point[1].y))
2037 (void) FormatLocaleString(message,MaxTextExtent,
2038 " %g %g l\n",point[1].x,point[1].y);
2040 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2041 (void) FormatLocaleString(message,MaxTextExtent,
2042 " %g %g %g %g v\n",point[0].x,point[0].y,
2043 point[1].x,point[1].y);
2045 if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
2046 (void) FormatLocaleString(message,MaxTextExtent,
2047 " %g %g %g %g y\n",last[2].x,last[2].y,
2048 point[1].x,point[1].y);
2050 (
void) FormatLocaleString(message,MaxTextExtent,
2051 " %g %g %g %g %g %g c\n",last[2].x,
2052 last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
2053 for (i=0; i < 3; i++)
2056 (void) ConcatenateString(&path,message);
2057 in_subpath=MagickTrue;
2062 if (knot_count == 0)
2068 if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
2069 (first[0].x == first[1].x) && (first[0].y == first[1].y))
2070 (void) FormatLocaleString(message,MaxTextExtent,
2071 " %g %g l z\n",first[1].x,first[1].y);
2073 if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
2074 (void) FormatLocaleString(message,MaxTextExtent,
2075 " %g %g %g %g v z\n",first[0].x,first[0].y,
2076 first[1].x,first[1].y);
2078 if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
2079 (void) FormatLocaleString(message,MaxTextExtent,
2080 " %g %g %g %g y z\n",last[2].x,last[2].y,
2081 first[1].x,first[1].y);
2083 (
void) FormatLocaleString(message,MaxTextExtent,
2084 " %g %g %g %g %g %g c z\n",last[2].x,
2085 last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
2086 (void) ConcatenateString(&path,message);
2087 in_subpath=MagickFalse;
2097 length-=MagickMin(24,(ssize_t) length);
2105 (void) FormatLocaleString(message,MaxTextExtent,
" eoclip\n");
2106 (void) ConcatenateString(&path,message);
2107 (void) FormatLocaleString(message,MaxTextExtent,
"} bind def");
2108 (void) ConcatenateString(&path,message);
2109 message=DestroyString(message);
2113static inline void TraceBezierCurve(
char *message,
PointInfo *last,
2120 if (((last+1)->x == (last+2)->x) && ((last+1)->y == (last+2)->y) &&
2121 (point->x == (point+1)->x) && (point->y == (point+1)->y))
2122 (void) FormatLocaleString(message,MagickPathExtent,
2123 "L %g %g\n",point[1].x,point[1].y);
2125 (
void) FormatLocaleString(message,MagickPathExtent,
"C %g %g %g %g %g %g\n",
2126 (last+2)->x,(last+2)->y,point->x,point->y,(point+1)->x,(point+1)->y);
2129static char *TraceSVGClippath(
const unsigned char *blob,
size_t length,
2130 const size_t columns,
const size_t rows)
2153 path=AcquireString((
char *) NULL);
2154 if (path == (
char *) NULL)
2155 return((
char *) NULL);
2156 message=AcquireString((
char *) NULL);
2157 (void) FormatLocaleString(message,MaxTextExtent,(
2158 "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
2159 "<svg xmlns=\"http://www.w3.org/2000/svg\""
2160 " width=\"%.20g\" height=\"%.20g\">\n"
2162 "<path fill-rule=\"evenodd\" style=\"fill:#000000;stroke:#000000;"
2163 "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),(
double) columns,
2165 (void) ConcatenateString(&path,message);
2166 (void) memset(point,0,
sizeof(point));
2167 (void) memset(first,0,
sizeof(first));
2168 (void) memset(last,0,
sizeof(last));
2170 in_subpath=MagickFalse;
2173 selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2179 if (knot_count != 0)
2182 length-=MagickMin(24,(ssize_t) length);
2188 knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
2190 length-=MagickMin(22,(ssize_t) length);
2198 if (knot_count == 0)
2204 length-=MagickMin(24,(ssize_t) length);
2210 for (i=0; i < 3; i++)
2212 y=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2213 x=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2214 point[i].x=(double) x*columns/4096.0/4096.0;
2215 point[i].y=(double) y*rows/4096.0/4096.0;
2217 if (in_subpath == MagickFalse)
2219 (void) FormatLocaleString(message,MaxTextExtent,
"M %g %g\n",
2220 point[1].x,point[1].y);
2221 for (i=0; i < 3; i++)
2229 TraceBezierCurve(message,last,point);
2230 for (i=0; i < 3; i++)
2233 (void) ConcatenateString(&path,message);
2234 in_subpath=MagickTrue;
2239 if (knot_count == 0)
2241 TraceBezierCurve(message,last,first);
2242 (void) ConcatenateString(&path,message);
2243 in_subpath=MagickFalse;
2253 length-=MagickMin(24,(ssize_t) length);
2261 (void) ConcatenateString(&path,
"\"/>\n</g>\n</svg>\n");
2262 message=DestroyString(message);
2266MagickExport
const char *GetImageProperty(
const Image *image,
2267 const char *property)
2284 assert(image != (
Image *) NULL);
2285 assert(image->signature == MagickCoreSignature);
2286 if (IsEventLogging() != MagickFalse)
2287 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2288 p=(
const char *) NULL;
2289 if (image->properties != (
void *) NULL)
2291 if (property == (
const char *) NULL)
2293 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
2298 if (LocaleNCompare(
"fx:",property,3) != 0)
2301 image->properties,property);
2302 if (p != (
const char *) NULL)
2306 if ((property == (
const char *) NULL) ||
2307 (strchr(property,
':') == (
char *) NULL))
2309 exception=(&((
Image *) image)->exception);
2314 if (LocaleNCompare(
"8bim:",property,5) == 0)
2316 (void) Get8BIMProperty(image,property);
2324 if (LocaleNCompare(
"exif:",property,5) == 0)
2326 (void) GetEXIFProperty(image,property);
2334 if (LocaleNCompare(
"fx:",property,3) == 0)
2336 if ((image->columns == 0) || (image->rows == 0))
2338 fx_info=AcquireFxInfo(image,property+3);
2339 status=FxEvaluateChannelExpression(fx_info,DefaultChannels,0,0,&alpha,
2341 fx_info=DestroyFxInfo(fx_info);
2342 if (status != MagickFalse)
2345 value[MaxTextExtent];
2347 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
2348 GetMagickPrecision(),(
double) alpha);
2349 (void) SetImageProperty((
Image *) image,property,value);
2358 if (LocaleNCompare(
"hex:",property,4) == 0)
2363 if ((image->columns == 0) || (image->rows == 0))
2365 GetMagickPixelPacket(image,&pixel);
2366 fx_info=AcquireFxInfo(image,property+4);
2367 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2369 pixel.red=(MagickRealType) QuantumRange*alpha;
2370 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2372 pixel.green=(MagickRealType) QuantumRange*alpha;
2373 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2375 pixel.blue=(MagickRealType) QuantumRange*alpha;
2376 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2378 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2379 if (image->colorspace == CMYKColorspace)
2381 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2383 pixel.index=(MagickRealType) QuantumRange*alpha;
2385 fx_info=DestroyFxInfo(fx_info);
2386 if (status != MagickFalse)
2391 GetColorTuple(&pixel,MagickTrue,hex);
2392 (void) SetImageProperty((
Image *) image,property,hex+1);
2401 if ((LocaleNCompare(
"icc:",property,4) == 0) ||
2402 (LocaleNCompare(
"icm:",property,4) == 0))
2404 (void) GetICCProperty(image);
2407 if (LocaleNCompare(
"iptc:",property,5) == 0)
2409 (void) GetIPTCProperty(image,property);
2417 if (LocaleNCompare(
"pixel:",property,6) == 0)
2422 GetMagickPixelPacket(image,&pixel);
2423 fx_info=AcquireFxInfo(image,property+6);
2424 status=FxEvaluateChannelExpression(fx_info,RedChannel,0,0,&alpha,
2426 pixel.red=(MagickRealType) QuantumRange*alpha;
2427 status&=FxEvaluateChannelExpression(fx_info,GreenChannel,0,0,&alpha,
2429 pixel.green=(MagickRealType) QuantumRange*alpha;
2430 status&=FxEvaluateChannelExpression(fx_info,BlueChannel,0,0,&alpha,
2432 pixel.blue=(MagickRealType) QuantumRange*alpha;
2433 status&=FxEvaluateChannelExpression(fx_info,OpacityChannel,0,0,&alpha,
2435 pixel.opacity=(MagickRealType) QuantumRange*(1.0-alpha);
2436 if (image->colorspace == CMYKColorspace)
2438 status&=FxEvaluateChannelExpression(fx_info,BlackChannel,0,0,
2440 pixel.index=(MagickRealType) QuantumRange*alpha;
2442 fx_info=DestroyFxInfo(fx_info);
2443 if (status != MagickFalse)
2446 name[MaxTextExtent];
2451 GetColorTuple(&pixel,MagickFalse,name);
2452 value=GetImageArtifact(image,
"pixel:compliance");
2453 if (value != (
char *) NULL)
2455 ComplianceType compliance=(ComplianceType) ParseCommandOption(
2456 MagickComplianceOptions,MagickFalse,value);
2457 (void) QueryMagickColorname(image,&pixel,compliance,name,
2460 (void) SetImageProperty((
Image *) image,property,name);
2469 if (LocaleNCompare(
"xmp:",property,4) == 0)
2471 (void) GetXMPProperty(image,property);
2479 if (image->properties != (
void *) NULL)
2482 image->properties,property);
2485 return((
const char *) NULL);
2574static const char *GetMagickPropertyLetter(
const ImageInfo *image_info,
2575 Image *image,
const char letter)
2577#define WarnNoImageInfoReturn(format,arg) \
2578 if (image_info == (ImageInfo *) NULL ) { \
2579 (void) ThrowMagickException(&image->exception,GetMagickModule(), \
2580 OptionWarning,"NoImageInfoForProperty",format,arg); \
2581 return((const char *) NULL); \
2585 value[MaxTextExtent];
2590 assert(image != (
Image *) NULL);
2591 assert(image->signature == MagickCoreSignature);
2592 if (IsEventLogging() != MagickFalse)
2593 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
2595 string=(
char *) NULL;
2603 (void) FormatMagickSize(image->extent,MagickFalse,value);
2604 if (image->extent == 0)
2605 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
2613 string=GetImageProperty(image,
"comment");
2614 if (
string == (
const char *) NULL)
2623 GetPathComponent(image->magick_filename,HeadPath,value);
2633 GetPathComponent(image->magick_filename,ExtensionPath,value);
2643 GetPathComponent(image->magick_filename,TailPath,value);
2653 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
2654 (
double) image->page.width,(
double) image->page.height,
2655 (
double) image->page.x,(
double) image->page.y);
2663 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2664 (image->rows != 0 ? image->rows : image->magick_rows));
2672 string=image->filename;
2680 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2681 GetNumberColors(image,(FILE *) NULL,&image->exception));
2689 string=GetImageProperty(image,
"label");
2690 if (
string == (
const char *) NULL)
2699 string=image->magick;
2707 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2708 GetImageListLength(image));
2716 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2717 string=image_info->filename;
2725 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2726 GetImageIndexInList(image));
2734 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2735 MAGICKCORE_QUANTUM_DEPTH);
2746 colorspace=image->colorspace;
2747 if ((image->columns != 0) && (image->rows != 0) &&
2748 (SetImageGray(image,&image->exception) != MagickFalse))
2749 colorspace=GRAYColorspace;
2750 (void) FormatLocaleString(value,MaxTextExtent,
"%s %s %s",
2751 CommandOptionToMnemonic(MagickClassOptions,(ssize_t)
2752 image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions,
2753 (ssize_t) colorspace),image->matte != MagickFalse ?
"Matte" :
"" );
2761 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2762 if (image_info->number_scenes != 0)
2763 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2766 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2775 GetPathComponent(image->magick_filename,BasePath,value);
2785 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2786 string=image_info->unique;
2794 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2795 (image->columns != 0 ? image->columns : image->magick_columns));
2803 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2804 fabs(image->x_resolution) > MagickEpsilon ? image->x_resolution :
2805 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2814 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
2815 fabs(image->y_resolution) > MagickEpsilon ? image->y_resolution :
2816 image->units == PixelsPerCentimeterResolution ? DefaultResolution/2.54 :
2825 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2834 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2835 CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte));
2843 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2845 if (image->extent == 0)
2846 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2847 GetBlobSize(image));
2855 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2856 CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
2857 image->compression));
2865 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2866 CommandOptionToMnemonic(MagickDisposeOptions,(ssize_t) image->dispose));
2879 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "
2880 "$-_.+!*'(),{}|\\^~[]`\"><#%;/?:@&=";
2885 (void) CopyMagickString(value,image->magick_filename,MaxTextExtent);
2887 q=value+strlen(value);
2888 for (p+=strspn(p,allowlist); p != q; p+=(ptrdiff_t) strspn(p,allowlist))
2897 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2898 image->magick_columns,(
double) image->magick_rows);
2906 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2907 image->page.height);
2915 string=image->magick_filename;
2920 if ((image != (
Image *) NULL) && (image->next == (
Image *) NULL))
2921 (void) FormatLocaleString(value,MagickPathExtent,
"%.20g\n",(
double)
2922 GetImageListLength(image));
2932 (void) FormatLocaleString(value,MaxTextExtent,
"%+ld%+ld",(
long)
2933 image->page.x,(
long) image->page.y);
2941 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
2942 image->page.width,(
double) image->page.height);
2950 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2951 (image->quality == 0 ? 92 : image->quality));
2959 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
2960 if (image_info->number_scenes == 0)
2961 string=
"2147483647";
2963 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2964 image_info->scene+image_info->number_scenes);
2972 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
2981 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
2982 CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
2991 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3000 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
3009 (void) FormatLocaleString(value,MaxTextExtent,
"%+.20g",(
double)
3018 WarnNoImageInfoReturn(
"\"%%%c\"",letter);
3019 string=image_info->zero;
3030 page=GetImageBoundingBox(image,&image->exception);
3031 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",
3032 (
double) page.width,(
double) page.height,(
double) page.x,(
double)
3041 if ((image->columns != 0) && (image->rows != 0))
3042 (void) SignatureImage(image);
3043 string=GetImageProperty(image,
"signature");
3057 if (
string != (
char *) NULL)
3059 (void) SetImageArtifact(image,
"get-property",
string);
3060 return(GetImageArtifact(image,
"get-property"));
3062 return((
char *) NULL);
3065MagickExport
const char *GetMagickProperty(
const ImageInfo *image_info,
3066 Image *image,
const char *property)
3069 value[MaxTextExtent];
3074 assert(property != (
const char *) NULL);
3075 assert(property[0] !=
'\0');
3076 if (property[1] ==
'\0')
3077 return(GetMagickPropertyLetter(image_info,image,*property));
3079 string=(
char *) NULL;
3084 if ((LocaleCompare(
"base",property) == 0) ||
3085 (LocaleCompare(
"basename",property) == 0) )
3087 GetPathComponent(image->magick_filename,BasePath,value);
3090 if (LocaleCompare(
"bit-depth",property) == 0)
3092 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3093 GetImageDepth(image,&image->exception));
3096 if (LocaleCompare(
"bounding-box",property) == 0)
3101 geometry=GetImageBoundingBox(image,&image->exception);
3102 (void) FormatLocaleString(value,MagickPathExtent,
"%g,%g %g,%g\n",
3103 (
double) geometry.x,(
double) geometry.y,
3104 (
double) geometry.x+geometry.width,
3105 (
double) geometry.y+geometry.height);
3112 if (LocaleCompare(
"channels",property) == 0)
3117 (void) FormatLocaleString(value,MaxTextExtent,
"%s",
3118 CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3119 image->colorspace));
3121 if (image->matte != MagickFalse)
3122 (void) ConcatenateMagickString(value,
"a",MaxTextExtent);
3125 if (LocaleCompare(
"colors",property) == 0)
3127 image->colors=GetNumberColors(image,(FILE *) NULL,&image->exception);
3128 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3132 if (LocaleCompare(
"colorspace",property) == 0)
3134 string=CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
3138 if (LocaleCompare(
"compose",property) == 0)
3140 string=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t)
3144 if (LocaleCompare(
"compression",property) == 0)
3146 string=CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
3147 image->compression);
3150 if (LocaleCompare(
"copyright",property) == 0)
3152 (void) CopyMagickString(value,GetMagickCopyright(),MaxTextExtent);
3159 if (LocaleCompare(
"depth",property) == 0)
3161 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3165 if (LocaleCompare(
"directory",property) == 0)
3167 GetPathComponent(image->magick_filename,HeadPath,value);
3174 if (LocaleCompare(
"entropy",property) == 0)
3179 (void) GetImageChannelEntropy(image,image_info->channel,&entropy,
3181 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3182 GetMagickPrecision(),entropy);
3185 if (LocaleCompare(
"extension",property) == 0)
3187 GetPathComponent(image->magick_filename,ExtensionPath,value);
3194 if (LocaleCompare(
"gamma",property) == 0)
3196 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3197 GetMagickPrecision(),image->gamma);
3200 if ((image_info != (
ImageInfo *) NULL) &&
3201 (LocaleCompare(
"group",property) == 0))
3203 (void) FormatLocaleString(value,MaxTextExtent,
"0x%lx",(
unsigned long)
3211 if (LocaleCompare(
"height",property) == 0)
3213 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3214 image->magick_rows != 0 ? (
double) image->magick_rows : 256.0);
3221 if (LocaleCompare(
"input",property) == 0)
3223 string=image->filename;
3226 if (LocaleCompare(
"interlace",property) == 0)
3228 string=CommandOptionToMnemonic(MagickInterlaceOptions,(ssize_t)
3236 if (LocaleCompare(
"kurtosis",property) == 0)
3242 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3243 &skewness,&image->exception);
3244 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3245 GetMagickPrecision(),kurtosis);
3252 if (LocaleCompare(
"magick",property) == 0)
3254 string=image->magick;
3257 if ((LocaleCompare(
"max",property) == 0) ||
3258 (LocaleCompare(
"maxima",property) == 0))
3264 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3265 &maximum,&image->exception);
3266 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3267 GetMagickPrecision(),maximum);
3270 if (LocaleCompare(
"mean",property) == 0)
3276 (void) GetImageChannelMean(image,image_info->channel,&mean,
3277 &standard_deviation,&image->exception);
3278 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3279 GetMagickPrecision(),mean);
3282 if ((LocaleCompare(
"min",property) == 0) ||
3283 (LocaleCompare(
"minima",property) == 0))
3289 (void) GetImageChannelRange(image,image_info->channel,&minimum,
3290 &maximum,&image->exception);
3291 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3292 GetMagickPrecision(),minimum);
3299 if (LocaleCompare(
"opaque",property) == 0)
3304 opaque=IsOpaqueImage(image,&image->exception);
3305 (void) CopyMagickString(value,opaque != MagickFalse ?
"true" :
3306 "false",MaxTextExtent);
3309 if (LocaleCompare(
"orientation",property) == 0)
3311 string=CommandOptionToMnemonic(MagickOrientationOptions,(ssize_t)
3312 image->orientation);
3315 if ((image_info != (
ImageInfo *) NULL) &&
3316 (LocaleCompare(
"output",property) == 0))
3318 (void) CopyMagickString(value,image_info->filename,MaxTextExtent);
3325 if (LocaleCompare(
"page",property) == 0)
3327 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",(
double)
3328 image->page.width,(
double) image->page.height);
3331 if (LocaleNCompare(
"papersize:",property,10) == 0)
3337 papersize=GetPageGeometry(property+10);
3338 if (papersize != (
const char *) NULL)
3341 page = { 0, 0, 0, 0 };
3343 (void) ParseAbsoluteGeometry(papersize,&page);
3344 (void) FormatLocaleString(value,MaxTextExtent,
"%.20gx%.20g",
3345 (
double) page.width,(
double) page.height);
3346 papersize=DestroyString(papersize);
3350#if defined(MAGICKCORE_LCMS_DELEGATE)
3351 if (LocaleCompare(
"profile:icc",property) == 0 ||
3352 LocaleCompare(
"profile:icm",property) == 0)
3354#if !defined(LCMS_VERSION) || (LCMS_VERSION < 2000)
3355#define cmsUInt32Number DWORD
3364 profile=GetImageProfile(image,property+8);
3368 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
3369 (cmsUInt32Number) GetStringInfoLength(profile));
3370 if (icc_profile != (cmsHPROFILE *) NULL)
3372#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
3373 string=cmsTakeProductName(icc_profile);
3375 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
3376 "en",
"US",value,MaxTextExtent);
3378 (void) cmsCloseProfile(icc_profile);
3382 if (LocaleCompare(
"printsize.x",property) == 0)
3384 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3385 GetMagickPrecision(),PerceptibleReciprocal(image->x_resolution)*
3389 if (LocaleCompare(
"printsize.y",property) == 0)
3391 (void) FormatLocaleString(value,MagickPathExtent,
"%.*g",
3392 GetMagickPrecision(),PerceptibleReciprocal(image->y_resolution)*
3396 if (LocaleCompare(
"profiles",property) == 0)
3401 ResetImageProfileIterator(image);
3402 name=GetNextImageProfile(image);
3403 if (name != (
char *) NULL)
3405 (void) CopyMagickString(value,name,MaxTextExtent);
3406 name=GetNextImageProfile(image);
3407 while (name != (
char *) NULL)
3409 ConcatenateMagickString(value,
",",MaxTextExtent);
3410 ConcatenateMagickString(value,name,MaxTextExtent);
3411 name=GetNextImageProfile(image);
3420 if (LocaleCompare(
"quality",property) == 0)
3422 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3430 if (LocaleCompare(
"rendering-intent",property) == 0)
3432 string=CommandOptionToMnemonic(MagickIntentOptions,(ssize_t)
3433 image->rendering_intent);
3436 if (LocaleCompare(
"resolution.x",property) == 0)
3438 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3439 image->x_resolution);
3442 if (LocaleCompare(
"resolution.y",property) == 0)
3444 (void) FormatLocaleString(value,MaxTextExtent,
"%g",
3445 image->y_resolution);
3452 if (LocaleCompare(
"scene",property) == 0)
3454 if ((image_info != (
ImageInfo *) NULL) &&
3455 (image_info->number_scenes != 0))
3456 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3459 (
void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3463 if (LocaleCompare(
"scenes",property) == 0)
3465 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3466 GetImageListLength(image));
3469 if (LocaleCompare(
"size",property) == 0)
3471 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
3474 if (LocaleCompare(
"skewness",property) == 0)
3480 (void) GetImageChannelKurtosis(image,image_info->channel,&kurtosis,
3481 &skewness,&image->exception);
3482 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3483 GetMagickPrecision(),skewness);
3486 if ((LocaleCompare(
"standard-deviation",property) == 0) ||
3487 (LocaleCompare(
"standard_deviation",property) == 0))
3493 (void) GetImageChannelMean(image,image_info->channel,&mean,
3494 &standard_deviation,&image->exception);
3495 (void) FormatLocaleString(value,MaxTextExtent,
"%.*g",
3496 GetMagickPrecision(),standard_deviation);
3503 if (LocaleCompare(
"type",property) == 0)
3505 string=CommandOptionToMnemonic(MagickTypeOptions,(ssize_t)
3506 IdentifyImageType(image,&image->exception));
3513 if ((image_info != (
ImageInfo *) NULL) &&
3514 (LocaleCompare(
"unique",property) == 0))
3516 string=image_info->unique;
3519 if (LocaleCompare(
"units",property) == 0)
3524 string=CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
3532 if (LocaleCompare(
"version",property) == 0)
3534 string=GetMagickVersion((
size_t *) NULL);
3541 if (LocaleCompare(
"width",property) == 0)
3543 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",(
double)
3544 (image->magick_columns != 0 ? image->magick_columns : 256));
3551 if ((LocaleCompare(
"xresolution",property) == 0) ||
3552 (LocaleCompare(
"x-resolution",property) == 0) )
3554 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3555 image->x_resolution);
3562 if ((LocaleCompare(
"yresolution",property) == 0) ||
3563 (LocaleCompare(
"y-resolution",property) == 0) )
3565 (void) FormatLocaleString(value,MaxTextExtent,
"%.20g",
3566 image->y_resolution);
3573 if ((image_info != (
ImageInfo *) NULL) &&
3574 (LocaleCompare(
"zero",property) == 0))
3576 string=image_info->zero;
3584 if (
string != (
char *) NULL)
3586 (void) SetImageArtifact(image,
"get-property",
string);
3587 return(GetImageArtifact(image,
"get-property"));
3589 return((
char *) NULL);
3614MagickExport
char *GetNextImageProperty(
const Image *image)
3616 assert(image != (
Image *) NULL);
3617 assert(image->signature == MagickCoreSignature);
3618 if (IsEventLogging() != MagickFalse)
3619 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
3621 if (image->properties == (
void *) NULL)
3622 return((
char *) NULL);
3623 return((
char *) GetNextKeyInSplayTree((
SplayTreeInfo *) image->properties));
3678MagickExport
char *InterpretImageProperties(
const ImageInfo *image_info,
3679 Image *image,
const char *embed_text)
3681#define ExtendInterpretText(string_length) \
3683 size_t length=(string_length); \
3684 if ((size_t) (q-interpret_text+length+1) >= extent) \
3687 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3688 MaxTextExtent,sizeof(*interpret_text)); \
3689 if (interpret_text == (char *) NULL) \
3691 if (property_info != image_info) \
3692 property_info=DestroyImageInfo(property_info); \
3693 return((char *) NULL); \
3695 q=interpret_text+strlen(interpret_text); \
3699#define AppendKeyValue2Text(key,value)\
3701 size_t length=strlen(key)+strlen(value)+2; \
3702 if ((size_t) (q-interpret_text+length+1) >= extent) \
3705 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3706 MaxTextExtent,sizeof(*interpret_text)); \
3707 if (interpret_text == (char *) NULL) \
3709 if (property_info != image_info) \
3710 property_info=DestroyImageInfo(property_info); \
3711 return((char *) NULL); \
3713 q=interpret_text+strlen(interpret_text); \
3715 q+=(ptrdiff_t) FormatLocaleString(q,extent,"%s=%s\n",(key),(value)); \
3718#define AppendString2Text(string) \
3720 size_t length=strlen((string)); \
3721 if ((size_t) (q-interpret_text+length+1) >= extent) \
3724 interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
3725 MaxTextExtent,sizeof(*interpret_text)); \
3726 if (interpret_text == (char *) NULL) \
3728 if (property_info != image_info) \
3729 property_info=DestroyImageInfo(property_info); \
3730 return((char *) NULL); \
3732 q=interpret_text+strlen(interpret_text); \
3734 (void) CopyMagickString(q,(string),extent); \
3735 q+=(ptrdiff_t) length; \
3756 assert(image != (
Image *) NULL);
3757 assert(image->signature == MagickCoreSignature);
3758 if (IsEventLogging() != MagickFalse)
3759 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
3760 if (embed_text == (
const char *) NULL)
3761 return(ConstantString(
""));
3763 while ((isspace((
int) ((
unsigned char) *p)) != 0) && (*p !=
'\0'))
3766 return(ConstantString(
""));
3767 if ((*p ==
'@') && (IsPathAccessible(p+1) != MagickFalse))
3772 if (IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,p) == MagickFalse)
3775 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3776 PolicyError,
"NotAuthorized",
"`%s'",p);
3777 return(ConstantString(
""));
3779 interpret_text=FileToString(p,~0UL,&image->exception);
3780 if (interpret_text != (
char *) NULL)
3781 return(interpret_text);
3789 property_info=CloneImageInfo(image_info);
3790 interpret_text=AcquireString(embed_text);
3791 extent=MaxTextExtent;
3793 for (q=interpret_text; *p!=
'\0';
3794 number=(isdigit((
int) ((
unsigned char) *p))) ? MagickTrue : MagickFalse,p++)
3800 ExtendInterpretText(MaxTextExtent);
3843 if (LocaleNCompare(
"<",p,4) == 0)
3849 if (LocaleNCompare(
">",p,4) == 0)
3855 if (LocaleNCompare(
"&",p,5) == 0)
3876 if ((*p ==
'\0') || (*p ==
'\'') || (*p ==
'"'))
3892 if (number != MagickFalse)
3898 value=GetMagickPropertyLetter(property_info,image,*p);
3899 if (value != (
char *) NULL)
3901 AppendString2Text(value);
3904 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3905 OptionWarning,
"UnknownImageProperty",
"\"%%%c\"",*p);
3910 pattern[2*MaxTextExtent] =
"\0";
3929 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3930 OptionWarning,
"UnknownImageProperty",
"\"%%[]\"");
3933 for (len=0; len<(MaxTextExtent-1L) && (*p !=
'\0');)
3935 if ((*p ==
'\\') && (*(p+1) !=
'\0'))
3940 pattern[len++]=(*p++);
3941 pattern[len++]=(*p++);
3950 pattern[len++]=(*p++);
3965 (void) ThrowMagickException(&image->exception,GetMagickModule(),
3966 OptionError,
"UnbalancedBraces",
"\"%%[%s\"",pattern);
3967 interpret_text=DestroyString(interpret_text);
3968 if (property_info != image_info)
3969 property_info=DestroyImageInfo(property_info);
3970 return((
char *) NULL);
3975 if (LocaleNCompare(
"fx:",pattern,3) == 0)
3989 fx_info=AcquireFxInfo(image,pattern+3);
3990 status=FxEvaluateChannelExpression(fx_info,property_info->channel,0,0,
3991 &value,&image->exception);
3992 fx_info=DestroyFxInfo(fx_info);
3993 if (status != MagickFalse)
3996 result[MagickPathExtent];
3998 (void) FormatLocaleString(result,MagickPathExtent,
"%.*g",
3999 GetMagickPrecision(),(
double) value);
4000 AppendString2Text(result);
4004 if (LocaleNCompare(
"option:",pattern,7) == 0)
4009 if (IsGlob(pattern+7) != MagickFalse)
4011 ResetImageOptionIterator(property_info);
4012 while ((key=GetNextImageOption(property_info)) != (
const char *) NULL)
4013 if (GlobExpression(key,pattern+7,MagickTrue) != MagickFalse)
4015 value=GetImageOption(property_info,key);
4016 if (value != (
const char *) NULL)
4017 AppendKeyValue2Text(key,value);
4022 value=GetImageOption(property_info,pattern+7);
4023 if (value != (
char *) NULL)
4024 AppendString2Text(value);
4028 if (LocaleNCompare(
"artifact:",pattern,9) == 0)
4033 if (IsGlob(pattern+9) != MagickFalse)
4035 ResetImageArtifactIterator(image);
4036 while ((key=GetNextImageArtifact(image)) != (
const char *) NULL)
4037 if (GlobExpression(key,pattern+9,MagickTrue) != MagickFalse)
4039 value=GetImageArtifact(image,key);
4040 if (value != (
const char *) NULL)
4041 AppendKeyValue2Text(key,value);
4046 value=GetImageArtifact(image,pattern+9);
4047 if (value != (
char *) NULL)
4048 AppendString2Text(value);
4058 value=GetImageProperty(image,pattern);
4059 if (value != (
const char *) NULL)
4061 AppendString2Text(value);
4068 if (IsGlob(pattern) != MagickFalse)
4070 ResetImagePropertyIterator(image);
4071 while ((key=GetNextImageProperty(image)) != (
const char *) NULL)
4072 if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
4074 value=GetImageProperty(image,key);
4075 if (value != (
const char *) NULL)
4076 AppendKeyValue2Text(key,value);
4086 value=GetMagickProperty(property_info,image,pattern);
4087 if (value != (
const char *) NULL)
4089 AppendString2Text(value);
4095 value=GetImageArtifact(image,pattern);
4096 if (value != (
char *) NULL)
4098 AppendString2Text(value);
4104 value=GetImageOption(property_info,pattern);
4105 if (value != (
char *) NULL)
4107 AppendString2Text(value);
4120 (void) ThrowMagickException(&image->exception,GetMagickModule(),
4121 OptionWarning,
"UnknownImageProperty",
"\"%%[%s]\"",pattern);
4126 if (property_info != image_info)
4127 property_info=DestroyImageInfo(property_info);
4128 return(interpret_text);
4159MagickExport
char *RemoveImageProperty(
Image *image,
const char *property)
4164 assert(image != (
Image *) NULL);
4165 assert(image->signature == MagickCoreSignature);
4166 if (IsEventLogging() != MagickFalse)
4167 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4169 if (image->properties == (
void *) NULL)
4170 return((
char *) NULL);
4171 value=(
char *) RemoveNodeFromSplayTree((
SplayTreeInfo *) image->properties,
4200MagickExport
void ResetImagePropertyIterator(
const Image *image)
4202 assert(image != (
Image *) NULL);
4203 assert(image->signature == MagickCoreSignature);
4204 if (IsEventLogging() != MagickFalse)
4205 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4207 if (image->properties == (
void *) NULL)
4209 ResetSplayTreeIterator((
SplayTreeInfo *) image->properties);
4240MagickExport MagickBooleanType SetImageProperty(
Image *image,
4241 const char *property,
const char *value)
4256 assert(image != (
Image *) NULL);
4257 assert(image->signature == MagickCoreSignature);
4258 if (IsEventLogging() != MagickFalse)
4259 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
4261 if (image->properties == (
void *) NULL)
4262 image->properties=NewSplayTree(CompareSplayTreeString,
4263 RelinquishMagickMemory,RelinquishMagickMemory);
4264 if (value == (
const char *) NULL)
4265 return(DeleteImageProperty(image,property));
4266 exception=(&image->exception);
4267 property_length=strlen(property);
4268 if ((property_length > 2) && (*(property+(property_length-2)) ==
':') &&
4269 (*(property+(property_length-1)) ==
'*'))
4271 (void) ThrowMagickException(exception,GetMagickModule(),
4272 OptionWarning,
"SetReadOnlyProperty",
"`%s'",property);
4273 return(MagickFalse);
4288 if (LocaleCompare(
"background",property) == 0)
4290 (void) QueryColorDatabase(value,&image->background_color,exception);
4293 if (LocaleCompare(
"bias",property) == 0)
4295 image->bias=StringToDoubleInterval(value,(
double) QuantumRange+1.0);
4298 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4299 ConstantString(property),ConstantString(value));
4305 if (LocaleCompare(
"colorspace",property) == 0)
4310 colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
4314 status=SetImageColorspace(image,(ColorspaceType) colorspace);
4317 if (LocaleCompare(
"compose",property) == 0)
4322 compose=ParseCommandOption(MagickComposeOptions,MagickFalse,value);
4325 image->compose=(CompositeOperator) compose;
4328 if (LocaleCompare(
"compress",property) == 0)
4333 compression=ParseCommandOption(MagickCompressOptions,MagickFalse,
4335 if (compression < 0)
4337 image->compression=(CompressionType) compression;
4340 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4341 ConstantString(property),ConstantString(value));
4347 if (LocaleCompare(
"delay",property) == 0)
4352 flags=ParseGeometry(value,&geometry_info);
4353 if ((flags & GreaterValue) != 0)
4355 if (image->delay > (
size_t) floor(geometry_info.rho+0.5))
4356 image->delay=(size_t) floor(geometry_info.rho+0.5);
4359 if ((flags & LessValue) != 0)
4361 if ((
double) image->delay < floor(geometry_info.rho+0.5))
4362 image->ticks_per_second=CastDoubleToLong(
4363 floor(geometry_info.sigma+0.5));
4366 image->delay=(size_t) floor(geometry_info.rho+0.5);
4367 if ((flags & SigmaValue) != 0)
4368 image->ticks_per_second=CastDoubleToLong(floor(
4369 geometry_info.sigma+0.5));
4372 if (LocaleCompare(
"density",property) == 0)
4377 flags=ParseGeometry(value,&geometry_info);
4378 if ((flags & RhoValue) != 0)
4379 image->x_resolution=geometry_info.rho;
4380 image->y_resolution=image->x_resolution;
4381 if ((flags & SigmaValue) != 0)
4382 image->y_resolution=geometry_info.sigma;
4384 if (LocaleCompare(
"depth",property) == 0)
4386 image->depth=StringToUnsignedLong(value);
4389 if (LocaleCompare(
"dispose",property) == 0)
4394 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,value);
4397 image->dispose=(DisposeType) dispose;
4400 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4401 ConstantString(property),ConstantString(value));
4407 if (LocaleCompare(
"gamma",property) == 0)
4409 image->gamma=StringToDouble(value,(
char **) NULL);
4412 if (LocaleCompare(
"gravity",property) == 0)
4417 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value);
4420 image->gravity=(GravityType) gravity;
4423 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4424 ConstantString(property),ConstantString(value));
4430 if (LocaleCompare(
"intensity",property) == 0)
4435 intensity=ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
4439 image->intensity=(PixelIntensityMethod) intensity;
4442 if (LocaleCompare(
"interpolate",property) == 0)
4447 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
4449 if (interpolate < 0)
4451 image->interpolate=(InterpolatePixelMethod) interpolate;
4454 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4455 ConstantString(property),ConstantString(value));
4461 if (LocaleCompare(
"loop",property) == 0)
4463 image->iterations=StringToUnsignedLong(value);
4466 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4467 ConstantString(property),ConstantString(value));
4473 if (LocaleCompare(
"page",property) == 0)
4478 geometry=GetPageGeometry(value);
4479 flags=ParseAbsoluteGeometry(geometry,&image->page);
4480 geometry=DestroyString(geometry);
4483 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4484 ConstantString(property),ConstantString(value));
4490 if (LocaleCompare(
"rendering-intent",property) == 0)
4495 rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse,
4497 if (rendering_intent < 0)
4499 image->rendering_intent=(RenderingIntent) rendering_intent;
4502 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4503 ConstantString(property),ConstantString(value));
4509 if (LocaleCompare(
"tile-offset",property) == 0)
4514 geometry=GetPageGeometry(value);
4515 flags=ParseAbsoluteGeometry(geometry,&image->tile_offset);
4516 geometry=DestroyString(geometry);
4519 if (LocaleCompare(
"type",property) == 0)
4524 type=ParseCommandOption(MagickTypeOptions,MagickFalse,value);
4526 return(MagickFalse);
4527 image->type=(ImageType) type;
4530 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4531 ConstantString(property),ConstantString(value));
4537 if (LocaleCompare(
"units",property) == 0)
4542 units=ParseCommandOption(MagickResolutionOptions,MagickFalse,value);
4545 image->units=(ResolutionType) units;
4548 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4549 ConstantString(property),ConstantString(value));
4554 status=AddValueToSplayTree((
SplayTreeInfo *) image->properties,
4555 ConstantString(property),ConstantString(value));