49#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickCore/image-private.h"
54#include "MagickCore/string-private.h"
81WandExport MagickBooleanType MagickDeleteImageArtifact(
MagickWand *wand,
85 assert(wand->signature == MagickWandSignature);
86 if (wand->debug != MagickFalse)
87 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
88 if (wand->images == (Image *) NULL)
90 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
91 "ContainsNoImages",
"`%s'",wand->name);
94 return(DeleteImageArtifact(wand->images,artifact));
122WandExport MagickBooleanType MagickDeleteImageProperty(
MagickWand *wand,
123 const char *property)
126 assert(wand->signature == MagickWandSignature);
127 if (wand->debug != MagickFalse)
128 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
129 if (wand->images == (Image *) NULL)
131 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
132 "ContainsNoImages",
"`%s'",wand->name);
135 return(DeleteImageProperty(wand->images,property));
163WandExport MagickBooleanType MagickDeleteOption(
MagickWand *wand,
167 assert(wand->signature == MagickWandSignature);
168 if (wand->debug != MagickFalse)
169 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
170 return(DeleteImageOption(wand->image_info,option));
196WandExport MagickBooleanType MagickGetAntialias(
const MagickWand *wand)
199 assert(wand->signature == MagickWandSignature);
200 if (wand->debug != MagickFalse)
201 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
202 return(wand->image_info->antialias);
233 assert(wand->signature == MagickWandSignature);
234 if (wand->debug != MagickFalse)
235 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
236 background_color=NewPixelWand();
237 PixelSetPixelColor(background_color,&wand->image_info->background_color);
238 return(background_color);
263WandExport ColorspaceType MagickGetColorspace(
MagickWand *wand)
266 assert(wand->signature == MagickWandSignature);
267 if (wand->debug != MagickFalse)
268 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
269 return(wand->image_info->colorspace);
294WandExport CompressionType MagickGetCompression(
MagickWand *wand)
297 assert(wand->signature == MagickWandSignature);
298 if (wand->debug != MagickFalse)
299 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
300 return(wand->image_info->compression);
325WandExport
size_t MagickGetCompressionQuality(
MagickWand *wand)
328 assert(wand->signature == MagickWandSignature);
329 if (wand->debug != MagickFalse)
330 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
331 return(wand->image_info->quality);
353WandExport
const char *MagickGetCopyright(
void)
355 return(GetMagickCopyright());
380WandExport
char *MagickGetFilename(
const MagickWand *wand)
383 assert(wand->signature == MagickWandSignature);
384 if (wand->debug != MagickFalse)
385 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
386 return(AcquireString(wand->image_info->filename));
411WandExport
char *MagickGetFont(
MagickWand *wand)
414 assert(wand->signature == MagickWandSignature);
415 if (wand->debug != MagickFalse)
416 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
417 if (wand->image_info->font == (
char *) NULL)
418 return((
char *) NULL);
419 return(AcquireString(wand->image_info->font));
444WandExport
char *MagickGetFormat(
MagickWand *wand)
447 assert(wand->signature == MagickWandSignature);
448 if (wand->debug != MagickFalse)
449 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
450 return(AcquireString(wand->image_info->magick));
475WandExport FilterType MagickGetFilter(
MagickWand *wand)
484 assert(wand->signature == MagickWandSignature);
485 if (wand->debug != MagickFalse)
486 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
487 option=GetImageOption(wand->image_info,
"filter");
488 if (option == (
const char *) NULL)
489 return(UndefinedFilter);
490 type=(FilterType) ParseCommandOption(MagickFilterOptions,MagickFalse,option);
516WandExport GravityType MagickGetGravity(
MagickWand *wand)
525 assert(wand->signature == MagickWandSignature);
526 if (wand->debug != MagickFalse)
527 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
528 option=GetImageOption(wand->image_info,
"gravity");
529 if (option == (
const char *) NULL)
530 return(UndefinedGravity);
531 type=(GravityType) ParseCommandOption(MagickGravityOptions,MagickFalse,
554WandExport
char *MagickGetHomeURL(
void)
556 return(GetMagickHomeURL());
585WandExport
char *MagickGetImageArtifact(
MagickWand *wand,
const char *artifact)
591 assert(wand->signature == MagickWandSignature);
592 if (wand->debug != MagickFalse)
593 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
594 if (wand->images == (Image *) NULL)
596 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
597 "ContainsNoImages",
"`%s'",wand->name);
598 return((
char *) NULL);
600 value=GetImageArtifact(wand->images,artifact);
601 if (value == (
const char *) NULL)
602 return((
char *) NULL);
603 return(ConstantString(value));
636WandExport
char **MagickGetImageArtifacts(
MagickWand *wand,
637 const char *pattern,
size_t *number_artifacts)
652 assert(wand->signature == MagickWandSignature);
653 if (wand->debug != MagickFalse)
654 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
655 if (wand->images == (Image *) NULL)
657 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
658 "ContainsNoImages",
"`%s'",wand->name);
659 return((
char **) NULL);
661 (void) GetImageProperty(wand->images,
"exif:*",wand->exception);
663 artifacts=(
char **) AcquireQuantumMemory(length,
sizeof(*artifacts));
664 if (artifacts == (
char **) NULL)
665 return((
char **) NULL);
666 ResetImagePropertyIterator(wand->images);
667 artifact=GetNextImageProperty(wand->images);
668 for (i=0; artifact != (
const char *) NULL; )
670 if ((*artifact !=
'[') &&
671 (GlobExpression(artifact,pattern,MagickFalse) != MagickFalse))
673 if ((i+1) >= (ssize_t) length)
676 artifacts=(
char **) ResizeQuantumMemory(artifacts,length,
678 if (artifacts == (
char **) NULL)
680 (void) ThrowMagickException(wand->exception,GetMagickModule(),
681 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
683 return((
char **) NULL);
686 artifacts[i]=ConstantString(artifact);
689 artifact=GetNextImageProperty(wand->images);
691 artifacts[i]=(
char *) NULL;
692 *number_artifacts=(size_t) i;
723WandExport
unsigned char *MagickGetImageProfile(
MagickWand *wand,
724 const char *name,
size_t *length)
733 assert(wand->signature == MagickWandSignature);
734 if (wand->debug != MagickFalse)
735 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
736 if (wand->images == (Image *) NULL)
738 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
739 "ContainsNoImages",
"`%s'",wand->name);
740 return((
unsigned char *) NULL);
743 if (wand->images->profiles == (SplayTreeInfo *) NULL)
744 return((
unsigned char *) NULL);
745 profile=GetImageProfile(wand->images,name);
746 if (profile == (StringInfo *) NULL)
747 return((
unsigned char *) NULL);
748 datum=(
unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile),
750 if (datum == (
unsigned char *) NULL)
751 return((
unsigned char *) NULL);
752 (void) memcpy(datum,GetStringInfoDatum(profile),GetStringInfoLength(profile));
753 *length=(size_t) GetStringInfoLength(profile);
787WandExport
char **MagickGetImageProfiles(
MagickWand *wand,
const char *pattern,
788 size_t *number_profiles)
803 assert(wand->signature == MagickWandSignature);
804 if (wand->debug != MagickFalse)
805 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
806 if (wand->images == (Image *) NULL)
808 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
809 "ContainsNoImages",
"`%s'",wand->name);
810 return((
char **) NULL);
812 (void) GetImageProfile(wand->images,
"exif:*");
814 profiles=(
char **) AcquireQuantumMemory(length,
sizeof(*profiles));
815 if (profiles == (
char **) NULL)
816 return((
char **) NULL);
817 ResetImageProfileIterator(wand->images);
818 property=GetNextImageProfile(wand->images);
819 for (i=0;
property != (
const char *) NULL; )
821 if ((*property !=
'[') &&
822 (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
824 if ((i+1) >= (ssize_t) length)
827 profiles=(
char **) ResizeQuantumMemory(profiles,length,
829 if (profiles == (
char **) NULL)
831 (void) ThrowMagickException(wand->exception,GetMagickModule(),
832 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
834 return((
char **) NULL);
837 profiles[i]=ConstantString(property);
840 property=GetNextImageProfile(wand->images);
842 profiles[i]=(
char *) NULL;
843 *number_profiles=(size_t) i;
873WandExport
char *MagickGetImageProperty(
MagickWand *wand,
const char *property)
879 assert(wand->signature == MagickWandSignature);
880 if (wand->debug != MagickFalse)
881 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
882 if (wand->images == (Image *) NULL)
884 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
885 "ContainsNoImages",
"`%s'",wand->name);
886 return((
char *) NULL);
888 value=GetImageProperty(wand->images,property,wand->exception);
889 if (value == (
const char *) NULL)
890 return((
char *) NULL);
891 return(ConstantString(value));
924WandExport
char **MagickGetImageProperties(
MagickWand *wand,
925 const char *pattern,
size_t *number_properties)
940 assert(wand->signature == MagickWandSignature);
941 if (wand->debug != MagickFalse)
942 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
943 if (wand->images == (Image *) NULL)
945 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
946 "ContainsNoImages",
"`%s'",wand->name);
947 return((
char **) NULL);
949 (void) GetImageProperty(wand->images,
"exif:*",wand->exception);
951 properties=(
char **) AcquireQuantumMemory(length,
sizeof(*properties));
952 if (properties == (
char **) NULL)
953 return((
char **) NULL);
954 ResetImagePropertyIterator(wand->images);
955 property=GetNextImageProperty(wand->images);
956 for (i=0;
property != (
const char *) NULL; )
958 if ((*property !=
'[') &&
959 (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
961 if ((i+1) >= (ssize_t) length)
964 properties=(
char **) ResizeQuantumMemory(properties,length,
965 sizeof(*properties));
966 if (properties == (
char **) NULL)
968 (void) ThrowMagickException(wand->exception,GetMagickModule(),
969 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
971 return((
char **) NULL);
974 properties[i]=ConstantString(property);
977 property=GetNextImageProperty(wand->images);
979 properties[i]=(
char *) NULL;
980 *number_properties=(size_t) i;
1006WandExport InterlaceType MagickGetInterlaceScheme(
MagickWand *wand)
1009 assert(wand->signature == MagickWandSignature);
1010 if (wand->debug != MagickFalse)
1011 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1012 return(wand->image_info->interlace);
1037WandExport PixelInterpolateMethod MagickGetInterpolateMethod(
MagickWand *wand)
1042 PixelInterpolateMethod
1046 assert(wand->signature == MagickWandSignature);
1047 if (wand->debug != MagickFalse)
1048 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1049 option=GetImageOption(wand->image_info,
"interpolate");
1050 if (option == (
const char *) NULL)
1051 return(UndefinedInterpolatePixel);
1052 method=(PixelInterpolateMethod) ParseCommandOption(MagickInterpolateOptions,
1053 MagickFalse,option);
1083WandExport
char *MagickGetOption(
MagickWand *wand,
const char *key)
1089 assert(wand->signature == MagickWandSignature);
1090 if (wand->debug != MagickFalse)
1091 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1092 option=GetImageOption(wand->image_info,key);
1093 return(ConstantString(option));
1126WandExport
char **MagickGetOptions(
MagickWand *wand,
const char *pattern,
1127 size_t *number_options)
1142 assert(wand->signature == MagickWandSignature);
1143 if (wand->debug != MagickFalse)
1144 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1145 if (wand->images == (Image *) NULL)
1147 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1148 "ContainsNoImages",
"`%s'",wand->name);
1149 return((
char **) NULL);
1152 options=(
char **) AcquireQuantumMemory(length,
sizeof(*options));
1153 if (options == (
char **) NULL)
1154 return((
char **) NULL);
1155 ResetImageOptionIterator(wand->image_info);
1156 option=GetNextImageOption(wand->image_info);
1157 for (i=0; option != (
const char *) NULL; )
1159 if ((*option !=
'[') &&
1160 (GlobExpression(option,pattern,MagickFalse) != MagickFalse))
1162 if ((i+1) >= (ssize_t) length)
1165 options=(
char **) ResizeQuantumMemory(options,length,
1167 if (options == (
char **) NULL)
1169 (void) ThrowMagickException(wand->exception,GetMagickModule(),
1170 ResourceLimitError,
"MemoryAllocationFailed",
"`%s'",
1172 return((
char **) NULL);
1175 options[i]=ConstantString(option);
1178 option=GetNextImageOption(wand->image_info);
1180 options[i]=(
char *) NULL;
1181 *number_options=(size_t) i;
1207WandExport OrientationType MagickGetOrientation(
MagickWand *wand)
1210 assert(wand->signature == MagickWandSignature);
1211 if (wand->debug != MagickFalse)
1212 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1213 return(wand->image_info->orientation);
1236WandExport
const char *MagickGetPackageName(
void)
1238 return(GetMagickPackageName());
1272WandExport MagickBooleanType MagickGetPage(
const MagickWand *wand,
1273 size_t *width,
size_t *height,ssize_t *x,ssize_t *y)
1279 assert(wand->signature == MagickWandSignature);
1280 if (wand->debug != MagickFalse)
1281 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1282 (void) memset(&geometry,0,
sizeof(geometry));
1283 (void) ParseAbsoluteGeometry(wand->image_info->page,&geometry);
1284 *width=geometry.width;
1285 *height=geometry.height;
1314WandExport
double MagickGetPointsize(
MagickWand *wand)
1317 assert(wand->signature == MagickWandSignature);
1318 if (wand->debug != MagickFalse)
1319 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1320 return(wand->image_info->pointsize);
1346WandExport
const char *MagickGetQuantumDepth(
size_t *depth)
1348 return(GetMagickQuantumDepth(depth));
1374WandExport
const char *MagickGetQuantumRange(
size_t *range)
1376 return(GetMagickQuantumRange(range));
1398WandExport
const char *MagickGetReleaseDate(
void)
1400 return(GetMagickReleaseDate());
1430WandExport MagickBooleanType MagickGetResolution(
const MagickWand *wand,
1431 double *x,
double *y)
1434 assert(wand->signature == MagickWandSignature);
1435 if (wand->debug != MagickFalse)
1436 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1437 *x=DefaultResolution;
1438 *y=DefaultResolution;
1439 if (wand->image_info->density != (
char *) NULL)
1447 flags=ParseGeometry(wand->image_info->density,&geometry_info);
1448 *x=geometry_info.rho;
1449 *y=geometry_info.sigma;
1450 if ((flags & SigmaValue) == 0)
1478WandExport MagickSizeType MagickGetResource(
const ResourceType type)
1480 return(GetMagickResource(type));
1505WandExport MagickSizeType MagickGetResourceLimit(
const ResourceType type)
1507 return(GetMagickResourceLimit(type));
1535WandExport
double *MagickGetSamplingFactors(
MagickWand *wand,
1536 size_t *number_factors)
1548 assert(wand->signature == MagickWandSignature);
1549 if (wand->debug != MagickFalse)
1550 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1552 sampling_factors=(
double *) NULL;
1553 if (wand->image_info->sampling_factor == (
char *) NULL)
1554 return(sampling_factors);
1556 for (p=wand->image_info->sampling_factor; p != (
char *) NULL; p=strchr(p,
':'))
1558 while (((
int) *p != 0) && ((isspace((
int) ((
unsigned char) *p)) != 0) ||
1563 sampling_factors=(
double *) AcquireQuantumMemory((
size_t) i+1,
1564 sizeof(*sampling_factors));
1565 if (sampling_factors == (
double *) NULL)
1566 ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",
1567 wand->image_info->filename);
1569 for (p=wand->image_info->sampling_factor; p != (
char *) NULL; p=strchr(p,
':'))
1571 while (((
int) *p != 0) && ((isspace((
int) ((
unsigned char) *p)) != 0) ||
1574 sampling_factors[i]=StringToDouble(p,(
char **) NULL);
1577 *number_factors=(size_t) i;
1578 return(sampling_factors);
1608WandExport MagickBooleanType MagickGetSize(
const MagickWand *wand,
1609 size_t *columns,
size_t *rows)
1615 assert(wand->signature == MagickWandSignature);
1616 if (wand->debug != MagickFalse)
1617 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1618 (void) memset(&geometry,0,
sizeof(geometry));
1619 (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
1620 *columns=geometry.width;
1621 *rows=geometry.height;
1651WandExport MagickBooleanType MagickGetSizeOffset(
const MagickWand *wand,
1658 assert(wand->signature == MagickWandSignature);
1659 if (wand->debug != MagickFalse)
1660 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1661 (void) memset(&geometry,0,
sizeof(geometry));
1662 (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
1689WandExport ImageType MagickGetType(
MagickWand *wand)
1692 assert(wand->signature == MagickWandSignature);
1693 if (wand->debug != MagickFalse)
1694 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1695 return(wand->image_info->type);
1721WandExport
const char *MagickGetVersion(
size_t *version)
1723 return(GetMagickVersion(version));
1758WandExport MagickBooleanType MagickProfileImage(
MagickWand *wand,
1759 const char *name,
const void *profile,
const size_t length)
1762 assert(wand->signature == MagickWandSignature);
1763 if (wand->debug != MagickFalse)
1764 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1765 if (wand->images == (Image *) NULL)
1766 ThrowWandException(WandError,
"ContainsNoImages",wand->name);
1767 return(ProfileImage(wand->images,name,profile,length,wand->exception));
1797WandExport
unsigned char *MagickRemoveImageProfile(
MagickWand *wand,
1798 const char *name,
size_t *length)
1807 assert(wand->signature == MagickWandSignature);
1808 if (wand->debug != MagickFalse)
1809 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1810 if (wand->images == (Image *) NULL)
1812 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1813 "ContainsNoImages",
"`%s'",wand->name);
1814 return((
unsigned char *) NULL);
1817 profile=RemoveImageProfile(wand->images,name);
1818 if (profile == (StringInfo *) NULL)
1819 return((
unsigned char *) NULL);
1820 datum=(
unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile),
1822 if (datum == (
unsigned char *) NULL)
1823 return((
unsigned char *) NULL);
1824 (void) memcpy(datum,GetStringInfoDatum(profile),
1825 GetStringInfoLength(profile));
1826 *length=GetStringInfoLength(profile);
1827 profile=DestroyStringInfo(profile);
1856WandExport MagickBooleanType MagickSetAntialias(
MagickWand *wand,
1857 const MagickBooleanType antialias)
1860 assert(wand->signature == MagickWandSignature);
1861 if (wand->debug != MagickFalse)
1862 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1863 wand->image_info->antialias=antialias;
1892WandExport MagickBooleanType MagickSetBackgroundColor(
MagickWand *wand,
1896 assert(wand->signature == MagickWandSignature);
1897 if (wand->debug != MagickFalse)
1898 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1899 PixelGetQuantumPacket(background,&wand->image_info->background_color);
1928WandExport MagickBooleanType MagickSetColorspace(
MagickWand *wand,
1929 const ColorspaceType colorspace)
1932 assert(wand->signature == MagickWandSignature);
1933 if (wand->debug != MagickFalse)
1934 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1935 wand->image_info->colorspace=colorspace;
1964WandExport MagickBooleanType MagickSetCompression(
MagickWand *wand,
1965 const CompressionType compression)
1968 assert(wand->signature == MagickWandSignature);
1969 if (wand->debug != MagickFalse)
1970 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
1971 wand->image_info->compression=compression;
2000WandExport MagickBooleanType MagickSetCompressionQuality(
MagickWand *wand,
2001 const size_t quality)
2004 assert(wand->signature == MagickWandSignature);
2005 if (wand->debug != MagickFalse)
2006 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2007 wand->image_info->quality=quality;
2036WandExport MagickBooleanType MagickSetDepth(
MagickWand *wand,
const size_t depth)
2039 assert(wand->signature == MagickWandSignature);
2040 if (wand->debug != MagickFalse)
2041 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2042 wand->image_info->depth=depth;
2073WandExport MagickBooleanType MagickSetExtract(
MagickWand *wand,
2074 const char *geometry)
2077 assert(wand->signature == MagickWandSignature);
2078 if (wand->debug != MagickFalse)
2079 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2080 if (wand->image_info->extract != (
char *) NULL)
2081 wand->image_info->extract=DestroyString(wand->image_info->extract);
2082 if (geometry != (
const char *) NULL)
2083 (
void) CloneString(&wand->image_info->extract,geometry);
2112WandExport MagickBooleanType MagickSetFilename(
MagickWand *wand,
2113 const char *filename)
2116 assert(wand->signature == MagickWandSignature);
2117 if (wand->debug != MagickFalse)
2118 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2119 if (filename != (
const char *) NULL)
2120 (
void) CopyMagickString(wand->image_info->filename,filename,
2149WandExport MagickBooleanType MagickSetFont(
MagickWand *wand,
const char *font)
2151 if ((font == (
const char *) NULL) || (*font ==
'\0'))
2152 return(MagickFalse);
2154 assert(wand->signature == MagickWandSignature);
2155 if (wand->debug != MagickFalse)
2156 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2157 (void) CloneString(&wand->image_info->font,font);
2185WandExport MagickBooleanType MagickSetFormat(
MagickWand *wand,
2192 assert(wand->signature == MagickWandSignature);
2193 if (wand->debug != MagickFalse)
2194 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2196 if ((format == (
char *) NULL) || (*format ==
'\0'))
2198 *wand->image_info->magick=
'\0';
2201 magick_info=GetMagickInfo(format,wand->exception);
2202 if (magick_info == (
const MagickInfo *) NULL)
2203 return(MagickFalse);
2204 ClearMagickException(wand->exception);
2205 (void) CopyMagickString(wand->image_info->magick,format,MagickPathExtent);
2234WandExport MagickBooleanType MagickSetFilter(
MagickWand *wand,
2235 const FilterType type)
2241 assert(wand->signature == MagickWandSignature);
2242 if (wand->debug != MagickFalse)
2243 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2244 status=SetImageOption(wand->image_info,
"filter",CommandOptionToMnemonic(
2245 MagickFilterOptions,(ssize_t) type));
2274WandExport MagickBooleanType MagickSetGravity(
MagickWand *wand,
2275 const GravityType type)
2281 assert(wand->signature == MagickWandSignature);
2282 if (wand->debug != MagickFalse)
2283 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2284 status=SetImageOption(wand->image_info,
"gravity",CommandOptionToMnemonic(
2285 MagickGravityOptions,(ssize_t) type));
2320WandExport MagickBooleanType MagickSetImageArtifact(
MagickWand *wand,
2321 const char *artifact,
const char *value)
2324 assert(wand->signature == MagickWandSignature);
2325 if (wand->debug != MagickFalse)
2326 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2327 if (wand->images == (Image *) NULL)
2328 ThrowWandException(WandError,
"ContainsNoImages",wand->name);
2329 return(SetImageArtifact(wand->images,artifact,value));
2364WandExport MagickBooleanType MagickSetImageProfile(
MagickWand *wand,
2365 const char *name,
const void *profile,
const size_t length)
2374 assert(wand->signature == MagickWandSignature);
2375 if (wand->debug != MagickFalse)
2376 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2377 if (wand->images == (Image *) NULL)
2378 ThrowWandException(WandError,
"ContainsNoImages",wand->name);
2379 profile_info=AcquireStringInfo((
size_t) length);
2380 SetStringInfoDatum(profile_info,(
const unsigned char *) profile);
2381 status=SetImageProfile(wand->images,name,profile_info,wand->exception);
2382 profile_info=DestroyStringInfo(profile_info);
2413WandExport MagickBooleanType MagickSetImageProperty(
MagickWand *wand,
2414 const char *property,
const char *value)
2420 assert(wand->signature == MagickWandSignature);
2421 if (wand->debug != MagickFalse)
2422 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2423 if (wand->images == (Image *) NULL)
2424 ThrowWandException(WandError,
"ContainsNoImages",wand->name);
2425 status=SetImageProperty(wand->images,property,value,wand->exception);
2455WandExport MagickBooleanType MagickSetInterlaceScheme(
MagickWand *wand,
2456 const InterlaceType interlace_scheme)
2459 assert(wand->signature == MagickWandSignature);
2460 if (wand->debug != MagickFalse)
2461 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2462 wand->image_info->interlace=interlace_scheme;
2491WandExport MagickBooleanType MagickSetInterpolateMethod(
MagickWand *wand,
2492 const PixelInterpolateMethod method)
2498 assert(wand->signature == MagickWandSignature);
2499 if (wand->debug != MagickFalse)
2500 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2501 status=SetImageOption(wand->image_info,
"interpolate",
2502 CommandOptionToMnemonic(MagickInterpolateOptions,(ssize_t) method));
2534WandExport MagickBooleanType MagickSetOption(
MagickWand *wand,
const char *key,
2538 assert(wand->signature == MagickWandSignature);
2539 if (wand->debug != MagickFalse)
2540 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2541 return(SetImageOption(wand->image_info,key,value));
2569WandExport MagickBooleanType MagickSetOrientation(
MagickWand *wand,
2570 const OrientationType orientation)
2573 assert(wand->signature == MagickWandSignature);
2574 if (wand->debug != MagickFalse)
2575 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2576 wand->image_info->orientation=orientation;
2612WandExport MagickBooleanType MagickSetPage(
MagickWand *wand,
2613 const size_t width,
const size_t height,
const ssize_t x,
2617 geometry[MagickPathExtent];
2620 assert(wand->signature == MagickWandSignature);
2621 if (wand->debug != MagickFalse)
2622 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2623 (void) FormatLocaleString(geometry,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",
2624 (
double) width,(double) height,(
double) x,(double) y);
2625 (void) CloneString(&wand->image_info->page,geometry);
2654WandExport MagickBooleanType MagickSetPassphrase(
MagickWand *wand,
2655 const char *passphrase)
2658 assert(wand->signature == MagickWandSignature);
2659 if (wand->debug != MagickFalse)
2660 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2661 (void) SetImageOption(wand->image_info,
"authenticate",passphrase);
2690WandExport MagickBooleanType MagickSetPointsize(
MagickWand *wand,
2691 const double pointsize)
2694 assert(wand->signature == MagickWandSignature);
2695 if (wand->debug != MagickFalse)
2696 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2697 wand->image_info->pointsize=pointsize;
2738WandExport MagickProgressMonitor MagickSetProgressMonitor(
MagickWand *wand,
2739 const MagickProgressMonitor progress_monitor,
void *client_data)
2741 MagickProgressMonitor
2745 assert(wand->signature == MagickWandSignature);
2746 if (wand->debug != MagickFalse)
2747 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2748 previous_monitor=SetImageInfoProgressMonitor(wand->image_info,
2749 progress_monitor,client_data);
2750 return(previous_monitor);
2780WandExport MagickBooleanType MagickSetResourceLimit(
const ResourceType type,
2781 const MagickSizeType limit)
2783 return(SetMagickResourceLimit(type,limit));
2813WandExport MagickBooleanType MagickSetResolution(
MagickWand *wand,
2814 const double x_resolution,
const double y_resolution)
2817 density[MagickPathExtent];
2820 assert(wand->signature == MagickWandSignature);
2821 if (wand->debug != MagickFalse)
2822 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2823 (void) FormatLocaleString(density,MagickPathExtent,
"%gx%g",x_resolution,
2825 (void) CloneString(&wand->image_info->density,density);
2857WandExport MagickBooleanType MagickSetSamplingFactors(
MagickWand *wand,
2858 const size_t number_factors,
const double *sampling_factors)
2861 sampling_factor[MagickPathExtent];
2867 assert(wand->signature == MagickWandSignature);
2868 if (wand->debug != MagickFalse)
2869 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2870 if (wand->image_info->sampling_factor != (
char *) NULL)
2871 wand->image_info->sampling_factor=(
char *)
2872 RelinquishMagickMemory(wand->image_info->sampling_factor);
2873 if (number_factors == 0)
2875 for (i=0; i < (ssize_t) (number_factors-1); i++)
2877 (void) FormatLocaleString(sampling_factor,MagickPathExtent,
"%g:",
2878 sampling_factors[i]);
2879 (void) ConcatenateString(&wand->image_info->sampling_factor,
2882 (void) FormatLocaleString(sampling_factor,MagickPathExtent,
"%g",
2883 sampling_factors[i]);
2884 (void) ConcatenateString(&wand->image_info->sampling_factor,sampling_factor);
2911WandExport
void MagickSetSeed(
const unsigned long seed)
2913 SetRandomSecretKey(seed);
2942WandExport MagickBooleanType MagickSetSecurityPolicy(
MagickWand *wand,
2946 assert(wand->signature == MagickWandSignature);
2947 if (wand->debug != MagickFalse)
2948 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2949 return(SetMagickSecurityPolicy(policy,wand->exception));
2980WandExport MagickBooleanType MagickSetSize(
MagickWand *wand,
2981 const size_t columns,
const size_t rows)
2984 geometry[MagickPathExtent];
2987 assert(wand->signature == MagickWandSignature);
2988 if (wand->debug != MagickFalse)
2989 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
2990 (void) FormatLocaleString(geometry,MagickPathExtent,
"%.20gx%.20g",(
double)
2991 columns,(double) rows);
2992 (void) CloneString(&wand->image_info->size,geometry);
3027WandExport MagickBooleanType MagickSetSizeOffset(
MagickWand *wand,
3028 const size_t columns,
const size_t rows,
const ssize_t offset)
3031 geometry[MagickPathExtent];
3034 assert(wand->signature == MagickWandSignature);
3035 if (wand->debug != MagickFalse)
3036 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3037 (void) FormatLocaleString(geometry,MagickPathExtent,
"%.20gx%.20g%+.20g",
3038 (
double) columns,(double) rows,(
double) offset);
3039 (void) CloneString(&wand->image_info->size,geometry);
3071WandExport MagickBooleanType MagickSetType(
MagickWand *wand,
3072 const ImageType image_type)
3075 assert(wand->signature == MagickWandSignature);
3076 if (wand->debug != MagickFalse)
3077 (void) LogMagickEvent(WandEvent,GetMagickModule(),
"%s",wand->name);
3078 wand->image_info->type=image_type;