/MagickWand/magick-property.c
C | 3051 lines | 1101 code | 107 blank | 1843 comment | 371 complexity | dec5cf4ccd3ce1e53af31db1f6a53539 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
Large files files are truncated, but you can click here to view the full file
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M M AAA GGGG IIIII CCCC K K %
- % MM MM A A G I C K K %
- % M M M AAAAA G GGG I C KKK %
- % M M A A G G I C K K %
- % M M A A GGGG IIIII CCCC K K %
- % %
- % PPPP RRRR OOO PPPP EEEEE RRRR TTTTT Y Y %
- % P P R R O O P P E R R T Y Y %
- % PPPP RRRR O O PPPP EEE RRRR T Y %
- % P R R O O P E R R T Y %
- % P R R OOO P EEEEE R R T Y %
- % %
- % %
- % Set or Get MagickWand Properties, Options, or Profiles %
- % %
- % Software Design %
- % Cristy %
- % August 2003 %
- % %
- % %
- % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %
- % dedicated to making software imaging solutions freely available. %
- % %
- % You may not use this file except in compliance with the License. You may %
- % obtain a copy of the License at %
- % %
- % https://imagemagick.org/script/license.php %
- % %
- % Unless required by applicable law or agreed to in writing, software %
- % distributed under the License is distributed on an "AS IS" BASIS, %
- % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
- % See the License for the specific language governing permissions and %
- % limitations under the License. %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- %
- %
- */
- /*
- Include declarations.
- */
- #include "MagickWand/studio.h"
- #include "MagickWand/MagickWand.h"
- #include "MagickWand/magick-wand-private.h"
- #include "MagickWand/wand.h"
- #include "MagickCore/string-private.h"
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k D e l e t e I m a g e A r t i f a c t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickDeleteImageArtifact() deletes a wand artifact.
- %
- % The format of the MagickDeleteImageArtifact method is:
- %
- % MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand,
- % const char *artifact)
- %
- % A description of each parameter follows:
- %
- % o image: the image.
- %
- % o artifact: the image artifact.
- %
- */
- WandExport MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand,
- const char *artifact)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return(MagickFalse);
- }
- return(DeleteImageArtifact(wand->images,artifact));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k D e l e t e I m a g e P r o p e r t y %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickDeleteImageProperty() deletes a wand property.
- %
- % The format of the MagickDeleteImageProperty method is:
- %
- % MagickBooleanType MagickDeleteImageProperty(MagickWand *wand,
- % const char *property)
- %
- % A description of each parameter follows:
- %
- % o image: the image.
- %
- % o property: the image property.
- %
- */
- WandExport MagickBooleanType MagickDeleteImageProperty(MagickWand *wand,
- const char *property)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return(MagickFalse);
- }
- return(DeleteImageProperty(wand->images,property));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k D e l e t e O p t i o n %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickDeleteOption() deletes a wand option.
- %
- % The format of the MagickDeleteOption method is:
- %
- % MagickBooleanType MagickDeleteOption(MagickWand *wand,
- % const char *option)
- %
- % A description of each parameter follows:
- %
- % o image: the image.
- %
- % o option: the image option.
- %
- */
- WandExport MagickBooleanType MagickDeleteOption(MagickWand *wand,
- const char *option)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(DeleteImageOption(wand->image_info,option));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t A n t i a l i a s %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetAntialias() returns the antialias property associated with the
- % wand.
- %
- % The format of the MagickGetAntialias method is:
- %
- % MagickBooleanType MagickGetAntialias(const MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport MagickBooleanType MagickGetAntialias(const MagickWand *wand)
- {
- assert(wand != (const MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(wand->image_info->antialias);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t B a c k g r o u n d C o l o r %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetBackgroundColor() returns the wand background color.
- %
- % The format of the MagickGetBackgroundColor method is:
- %
- % PixelWand *MagickGetBackgroundColor(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport PixelWand *MagickGetBackgroundColor(MagickWand *wand)
- {
- PixelWand
- *background_color;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- background_color=NewPixelWand();
- PixelSetPixelColor(background_color,&wand->image_info->background_color);
- return(background_color);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t C o l o r s p a c e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetColorspace() gets the wand colorspace type.
- %
- % The format of the MagickGetColorspace method is:
- %
- % ColorspaceType MagickGetColorspace(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport ColorspaceType MagickGetColorspace(MagickWand *wand)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(wand->image_info->colorspace);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t C o m p r e s s i o n %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetCompression() gets the wand compression type.
- %
- % The format of the MagickGetCompression method is:
- %
- % CompressionType MagickGetCompression(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport CompressionType MagickGetCompression(MagickWand *wand)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(wand->image_info->compression);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t C o m p r e s s i o n Q u a l i t y %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetCompressionQuality() gets the wand compression quality.
- %
- % The format of the MagickGetCompressionQuality method is:
- %
- % size_t MagickGetCompressionQuality(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport size_t MagickGetCompressionQuality(MagickWand *wand)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(wand->image_info->quality);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t C o p y r i g h t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetCopyright() returns the ImageMagick API copyright as a string
- % constant.
- %
- % The format of the MagickGetCopyright method is:
- %
- % const char *MagickGetCopyright(void)
- %
- */
- WandExport const char *MagickGetCopyright(void)
- {
- return(GetMagickCopyright());
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t F i l e n a m e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetFilename() returns the filename associated with an image sequence.
- %
- % The format of the MagickGetFilename method is:
- %
- % const char *MagickGetFilename(const MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport char *MagickGetFilename(const MagickWand *wand)
- {
- assert(wand != (const MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(AcquireString(wand->image_info->filename));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t F o n t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetFont() returns the font associated with the MagickWand.
- %
- % The format of the MagickGetFont method is:
- %
- % char *MagickGetFont(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport char *MagickGetFont(MagickWand *wand)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->image_info->font == (char *) NULL)
- return((char *) NULL);
- return(AcquireString(wand->image_info->font));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t F o r m a t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetFormat() returns the format of the magick wand.
- %
- % The format of the MagickGetFormat method is:
- %
- % const char MagickGetFormat(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport char *MagickGetFormat(MagickWand *wand)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(AcquireString(wand->image_info->magick));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t G r a v i t y %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetGravity() gets the wand gravity.
- %
- % The format of the MagickGetGravity method is:
- %
- % GravityType MagickGetGravity(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport GravityType MagickGetGravity(MagickWand *wand)
- {
- const char
- *option;
- GravityType
- type;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- option=GetImageOption(wand->image_info,"gravity");
- if (option == (const char *) NULL)
- return(UndefinedGravity);
- type=(GravityType) ParseCommandOption(MagickGravityOptions,MagickFalse,option);
- return(type);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t H o m e U R L %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetHomeURL() returns the ImageMagick home URL.
- %
- % The format of the MagickGetHomeURL method is:
- %
- % char *MagickGetHomeURL(void)
- %
- */
- WandExport char *MagickGetHomeURL(void)
- {
- return(GetMagickHomeURL());
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I m a g e A r t i f a c t %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetImageArtifact() returns a value associated with the specified
- % artifact. Use MagickRelinquishMemory() to free the value when you are
- % finished with it.
- %
- % The format of the MagickGetImageArtifact method is:
- %
- % char *MagickGetImageArtifact(MagickWand *wand,const char *artifact)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o artifact: the artifact.
- %
- */
- WandExport char *MagickGetImageArtifact(MagickWand *wand,const char *artifact)
- {
- const char
- *value;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return((char *) NULL);
- }
- value=GetImageArtifact(wand->images,artifact);
- if (value == (const char *) NULL)
- return((char *) NULL);
- return(ConstantString(value));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I m a g e P r o p e r t i e s %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetImageArtifacts() returns all the artifact names that match the
- % specified pattern associated with a wand. Use MagickGetImageProperty() to
- % return the value of a particular artifact. Use MagickRelinquishMemory() to
- % free the value when you are finished with it.
- %
- % The format of the MagickGetImageArtifacts method is:
- %
- % char *MagickGetImageArtifacts(MagickWand *wand,
- % const char *pattern,size_t *number_artifacts)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o pattern: Specifies a pointer to a text string containing a pattern.
- %
- % o number_artifacts: the number artifacts associated with this wand.
- %
- */
- WandExport char **MagickGetImageArtifacts(MagickWand *wand,
- const char *pattern,size_t *number_artifacts)
- {
- char
- **artifacts;
- const char
- *artifact;
- register ssize_t
- i;
- size_t
- length;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return((char **) NULL);
- }
- (void) GetImageProperty(wand->images,"exif:*",wand->exception);
- length=1024;
- artifacts=(char **) AcquireQuantumMemory(length,sizeof(*artifacts));
- if (artifacts == (char **) NULL)
- return((char **) NULL);
- ResetImagePropertyIterator(wand->images);
- artifact=GetNextImageProperty(wand->images);
- for (i=0; artifact != (const char *) NULL; )
- {
- if ((*artifact != '[') &&
- (GlobExpression(artifact,pattern,MagickFalse) != MagickFalse))
- {
- if ((i+1) >= (ssize_t) length)
- {
- length<<=1;
- artifacts=(char **) ResizeQuantumMemory(artifacts,length,
- sizeof(*artifacts));
- if (artifacts == (char **) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",
- wand->name);
- return((char **) NULL);
- }
- }
- artifacts[i]=ConstantString(artifact);
- i++;
- }
- artifact=GetNextImageProperty(wand->images);
- }
- artifacts[i]=(char *) NULL;
- *number_artifacts=(size_t) i;
- return(artifacts);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I m a g e P r o f i l e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetImageProfile() returns the named image profile.
- %
- % The format of the MagickGetImageProfile method is:
- %
- % unsigned char *MagickGetImageProfile(MagickWand *wand,const char *name,
- % size_t *length)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o name: Name of profile to return: ICC, IPTC, or generic profile.
- %
- % o length: the length of the profile.
- %
- */
- WandExport unsigned char *MagickGetImageProfile(MagickWand *wand,
- const char *name,size_t *length)
- {
- const StringInfo
- *profile;
- unsigned char
- *datum;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return((unsigned char *) NULL);
- }
- *length=0;
- if (wand->images->profiles == (SplayTreeInfo *) NULL)
- return((unsigned char *) NULL);
- profile=GetImageProfile(wand->images,name);
- if (profile == (StringInfo *) NULL)
- return((unsigned char *) NULL);
- datum=(unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile),
- sizeof(*datum));
- if (datum == (unsigned char *) NULL)
- return((unsigned char *) NULL);
- (void) memcpy(datum,GetStringInfoDatum(profile),
- GetStringInfoLength(profile));
- *length=(size_t) GetStringInfoLength(profile);
- return(datum);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I m a g e P r o f i l e s %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetImageProfiles() returns all the profile names that match the
- % specified pattern associated with a wand. Use MagickGetImageProfile() to
- % return the value of a particular property. Use MagickRelinquishMemory() to
- % free the value when you are finished with it.
- %
- % The format of the MagickGetImageProfiles method is:
- %
- % char *MagickGetImageProfiles(MagickWand *wand,const char *pattern,
- % size_t *number_profiles)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o pattern: Specifies a pointer to a text string containing a pattern.
- %
- % o number_profiles: the number profiles associated with this wand.
- %
- */
- WandExport char **MagickGetImageProfiles(MagickWand *wand,const char *pattern,
- size_t *number_profiles)
- {
- char
- **profiles;
- const char
- *property;
- register ssize_t
- i;
- size_t
- length;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return((char **) NULL);
- }
- (void) GetImageProfile(wand->images,"exif:*");
- length=1024;
- profiles=(char **) AcquireQuantumMemory(length,sizeof(*profiles));
- if (profiles == (char **) NULL)
- return((char **) NULL);
- ResetImageProfileIterator(wand->images);
- property=GetNextImageProfile(wand->images);
- for (i=0; property != (const char *) NULL; )
- {
- if ((*property != '[') &&
- (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
- {
- if ((i+1) >= (ssize_t) length)
- {
- length<<=1;
- profiles=(char **) ResizeQuantumMemory(profiles,length,
- sizeof(*profiles));
- if (profiles == (char **) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",
- wand->name);
- return((char **) NULL);
- }
- }
- profiles[i]=ConstantString(property);
- i++;
- }
- property=GetNextImageProfile(wand->images);
- }
- profiles[i]=(char *) NULL;
- *number_profiles=(size_t) i;
- return(profiles);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I m a g e P r o p e r t y %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetImageProperty() returns a value associated with the specified
- % property. Use MagickRelinquishMemory() to free the value when you are
- % finished with it.
- %
- % The format of the MagickGetImageProperty method is:
- %
- % char *MagickGetImageProperty(MagickWand *wand,const char *property)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o property: the property.
- %
- */
- WandExport char *MagickGetImageProperty(MagickWand *wand,const char *property)
- {
- const char
- *value;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return((char *) NULL);
- }
- value=GetImageProperty(wand->images,property,wand->exception);
- if (value == (const char *) NULL)
- return((char *) NULL);
- return(ConstantString(value));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I m a g e P r o p e r t i e s %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetImageProperties() returns all the property names that match the
- % specified pattern associated with a wand. Use MagickGetImageProperty() to
- % return the value of a particular property. Use MagickRelinquishMemory() to
- % free the value when you are finished with it.
- %
- % The format of the MagickGetImageProperties method is:
- %
- % char *MagickGetImageProperties(MagickWand *wand,
- % const char *pattern,size_t *number_properties)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o pattern: Specifies a pointer to a text string containing a pattern.
- %
- % o number_properties: the number properties associated with this wand.
- %
- */
- WandExport char **MagickGetImageProperties(MagickWand *wand,
- const char *pattern,size_t *number_properties)
- {
- char
- **properties;
- const char
- *property;
- register ssize_t
- i;
- size_t
- length;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return((char **) NULL);
- }
- (void) GetImageProperty(wand->images,"exif:*",wand->exception);
- length=1024;
- properties=(char **) AcquireQuantumMemory(length,sizeof(*properties));
- if (properties == (char **) NULL)
- return((char **) NULL);
- ResetImagePropertyIterator(wand->images);
- property=GetNextImageProperty(wand->images);
- for (i=0; property != (const char *) NULL; )
- {
- if ((*property != '[') &&
- (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
- {
- if ((i+1) >= (ssize_t) length)
- {
- length<<=1;
- properties=(char **) ResizeQuantumMemory(properties,length,
- sizeof(*properties));
- if (properties == (char **) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",
- wand->name);
- return((char **) NULL);
- }
- }
- properties[i]=ConstantString(property);
- i++;
- }
- property=GetNextImageProperty(wand->images);
- }
- properties[i]=(char *) NULL;
- *number_properties=(size_t) i;
- return(properties);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I n t e r l a c e S c h e m e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetInterlaceScheme() gets the wand interlace scheme.
- %
- % The format of the MagickGetInterlaceScheme method is:
- %
- % InterlaceType MagickGetInterlaceScheme(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport InterlaceType MagickGetInterlaceScheme(MagickWand *wand)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(wand->image_info->interlace);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t I n t e r p o l a t e M e t h o d %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetInterpolateMethod() gets the wand compression.
- %
- % The format of the MagickGetInterpolateMethod method is:
- %
- % PixelInterpolateMethod MagickGetInterpolateMethod(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport PixelInterpolateMethod MagickGetInterpolateMethod(MagickWand *wand)
- {
- const char
- *option;
- PixelInterpolateMethod
- method;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- option=GetImageOption(wand->image_info,"interpolate");
- if (option == (const char *) NULL)
- return(UndefinedInterpolatePixel);
- method=(PixelInterpolateMethod) ParseCommandOption(MagickInterpolateOptions,
- MagickFalse,option);
- return(method);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t O p t i o n %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetOption() returns a value associated with a wand and the specified
- % key. Use MagickRelinquishMemory() to free the value when you are finished
- % with it.
- %
- % The format of the MagickGetOption method is:
- %
- % char *MagickGetOption(MagickWand *wand,const char *key)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o key: the key.
- %
- */
- WandExport char *MagickGetOption(MagickWand *wand,const char *key)
- {
- const char
- *option;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- option=GetImageOption(wand->image_info,key);
- return(ConstantString(option));
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t O p t i o n s %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetOptions() returns all the option names that match the specified
- % pattern associated with a wand. Use MagickGetOption() to return the value
- % of a particular option. Use MagickRelinquishMemory() to free the value
- % when you are finished with it.
- %
- % The format of the MagickGetOptions method is:
- %
- % char *MagickGetOptions(MagickWand *wand,const char *pattern,
- % size_t *number_options)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o pattern: Specifies a pointer to a text string containing a pattern.
- %
- % o number_options: the number options associated with this wand.
- %
- */
- WandExport char **MagickGetOptions(MagickWand *wand,const char *pattern,
- size_t *number_options)
- {
- char
- **options;
- const char
- *option;
- register ssize_t
- i;
- size_t
- length;
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- if (wand->images == (Image *) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
- "ContainsNoImages","`%s'",wand->name);
- return((char **) NULL);
- }
- length=1024;
- options=(char **) AcquireQuantumMemory(length,sizeof(*options));
- if (options == (char **) NULL)
- return((char **) NULL);
- ResetImageOptionIterator(wand->image_info);
- option=GetNextImageOption(wand->image_info);
- for (i=0; option != (const char *) NULL; )
- {
- if ((*option != '[') &&
- (GlobExpression(option,pattern,MagickFalse) != MagickFalse))
- {
- if ((i+1) >= (ssize_t) length)
- {
- length<<=1;
- options=(char **) ResizeQuantumMemory(options,length,
- sizeof(*options));
- if (options == (char **) NULL)
- {
- (void) ThrowMagickException(wand->exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",
- wand->name);
- return((char **) NULL);
- }
- }
- options[i]=ConstantString(option);
- i++;
- }
- option=GetNextImageOption(wand->image_info);
- }
- options[i]=(char *) NULL;
- *number_options=(size_t) i;
- return(options);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t O r i e n t a t i o n %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetOrientation() gets the wand orientation type.
- %
- % The format of the MagickGetOrientation method is:
- %
- % OrientationType MagickGetOrientation(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport OrientationType MagickGetOrientation(MagickWand *wand)
- {
- assert(wand != (MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- return(wand->image_info->orientation);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t P a c k a g e N a m e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetPackageName() returns the ImageMagick package name as a string
- % constant.
- %
- % The format of the MagickGetPackageName method is:
- %
- % const char *MagickGetPackageName(void)
- %
- %
- */
- WandExport const char *MagickGetPackageName(void)
- {
- return(GetMagickPackageName());
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t P a g e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetPage() returns the page geometry associated with the magick wand.
- %
- % The format of the MagickGetPage method is:
- %
- % MagickBooleanType MagickGetPage(const MagickWand *wand,
- % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- % o width: the page width.
- %
- % o height: page height.
- %
- % o x: the page x-offset.
- %
- % o y: the page y-offset.
- %
- */
- WandExport MagickBooleanType MagickGetPage(const MagickWand *wand,
- size_t *width,size_t *height,ssize_t *x,ssize_t *y)
- {
- RectangleInfo
- geometry;
- assert(wand != (const MagickWand *) NULL);
- assert(wand->signature == MagickWandSignature);
- if (wand->debug != MagickFalse)
- (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
- (void) memset(&geometry,0,sizeof(geometry));
- (void) ParseAbsoluteGeometry(wand->image_info->page,&geometry);
- *width=geometry.width;
- *height=geometry.height;
- *x=geometry.x;
- *y=geometry.y;
- return(MagickTrue);
- }
- /*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % M a g i c k G e t P o i n t s i z e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % MagickGetPointsize() returns the font pointsize associated with the
- % MagickWand.
- %
- % The format of the MagickGetPointsize method is:
- %
- % double MagickGetPointsize(MagickWand *wand)
- %
- % A description of each parameter follows:
- %
- % o wand: the magick wand.
- %
- */
- WandExport double MagickGetPointsize(MagickWand *wan…
Large files files are truncated, but you can click here to view the full file