#include "MagickWand/studio.h"
#include "MagickWand/MagickWand.h"
#include "MagickWand/magick-wand-private.h"
+#include "MagickWand/mogrify.h"
#include "MagickWand/wand.h"
#include "MagickWand/wandcli.h"
#include "MagickWand/wandcli-private.h"
#include "MagickCore/string-private.h"
#include "MagickCore/pixel-private.h"
\f
+/*
+ Constant declaration.
+*/
+static const char
+ MogrifyBackgroundColor[] = "#fff", /* white */
+ MogrifyBorderColor[] = "#dfdfdf", /* sRGB gray */
+ MogrifyMatteColor[] = "#bdbdbd"; /* slightly darker gray */
+\f
/*
Define declarations.
*/
/* FUTURE: why is this default so specific? */
#define DEFAULT_DISSIMILARITY_THRESHOLD "0.31830988618379067154"
-/*
- Constant declaration. (temporary exports)
-*/
-static const char
- BackgroundColor[] = "#fff", /* white */
- BorderColor[] = "#dfdfdf", /* sRGB gray */
- MatteColor[] = "#bdbdbd"; /* slightly darker gray */
-
/* For Debugging Geometry Input */
#define ReportGeometry(flags,info) \
(void) FormatLocaleFile(stderr, "Geometry = 0x%04X : %lg x %lg %+lg %+lg\n", \
if (image != (Image *) NULL)
return(image);
read_info=CloneImageInfo(image_info);
- (void) CopyMagickString(read_info->filename,path,MaxTextExtent);
+ if (path != (const char *) NULL)
+ (void) CopyMagickString(read_info->filename,path,MaxTextExtent);
image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (image != (Image *) NULL)
Better error handling of QueryColorCompliance() needed.
*/
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
- (void) QueryColorCompliance(ArgOption(BackgroundColor),AllCompliance,
+ (void) QueryColorCompliance(ArgOption(MogrifyBackgroundColor),AllCompliance,
&_image_info->background_color,_exception);
break;
}
break;
}
(void) DeleteImageOption(_image_info,option+1);
- (void) QueryColorCompliance(BorderColor,AllCompliance,
+ (void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
&_image_info->border_color,_exception);
- (void) QueryColorCompliance(BorderColor,AllCompliance,
+ (void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
&_draw_info->border_color,_exception);
break;
}
{
/* SyncImageSettings() used to set per-image attribute. */
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
- (void) QueryColorCompliance(ArgOption(MatteColor),AllCompliance,
+ (void) QueryColorCompliance(ArgOption(MogrifyMatteColor),AllCompliance,
&_image_info->matte_color,_exception);
break;
}
}
case 'c':
{
+ if (LocaleCompare("canny",option+1) == 0)
+ {
+ flags=ParseGeometry(arg1,&geometry_info);
+ if ((flags & (RhoValue|SigmaValue)) == 0)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=1.0;
+ if ((flags & XiValue) == 0)
+ geometry_info.xi=10;
+ if ((flags & PsiValue) == 0)
+ geometry_info.psi=30;
+ if ((flags & PercentValue) != 0)
+ {
+ geometry_info.xi/=100.0;
+ geometry_info.psi/=100.0;
+ }
+ new_image=CannyEdgeImage(_image,geometry_info.rho,geometry_info.sigma,
+ geometry_info.xi,geometry_info.psi,_exception);
+ break;
+ }
if (LocaleCompare("cdl",option+1) == 0)
{
/* Note: arguments do not have percent escapes expanded */
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
+ case 'h':
+ {
+ if (LocaleCompare("hough-lines",option+1) == 0)
+ {
+ flags=ParseGeometry(arg1,&geometry_info);
+ if ((flags & (RhoValue|SigmaValue)) == 0)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=geometry_info.rho;
+ if ((flags & XiValue) == 0)
+ geometry_info.xi=40;
+ new_image=HoughLineImage(_image,(size_t) geometry_info.rho,
+ (size_t) geometry_info.sigma,(size_t) geometry_info.xi,_exception);
+ break;
+ }
+ CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
+ }
case 'i':
{
if (LocaleCompare("identify",option+1) == 0)
{
CLIWandWarnReplaced(IfNormalOp?"-alpha Set":"-alpha Off");
(void) SetImageAlphaChannel(_image,IfNormalOp ? SetAlphaChannel :
- DeactivateAlphaChannel, _exception);
+ DeactivateAlphaChannel, _exception);
+ break;
+ }
+ if (LocaleCompare("mean-shift",option+1) == 0)
+ {
+ flags=ParseGeometry(arg1,&geometry_info);
+ if ((flags & (RhoValue|SigmaValue)) == 0)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=1.0;
+ if ((flags & XiValue) == 0)
+ geometry_info.xi=0.10*QuantumRange;
+ if ((flags & PercentValue) != 0)
+ geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0;
+ new_image=MeanShiftImage(_image,(size_t) geometry_info.rho,
+ (size_t) geometry_info.sigma,geometry_info.xi,_exception);
break;
}
if (LocaleCompare("median",option+1) == 0)
}
case 'r':
{
- if (LocaleCompare("radial-blur",option+1) == 0)
+ if (LocaleCompare("rotational-blur",option+1) == 0)
{
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & RhoValue) == 0)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- new_image=RadialBlurImage(_image,geometry_info.rho,_exception);
+ new_image=RotationalBlurImage(_image,geometry_info.rho,_exception);
break;
}
if (LocaleCompare("raise",option+1) == 0)
/*
Support old style syntax, filter="-option arg1".
*/
+ assert(arg1 != (const char *) NULL);
length=strlen(arg1);
token=(char *) NULL;
if (~length >= (MaxTextExtent-1))