Used by many coders including PNG
SyncImageSettings() used to set per-image attribute.
*/
- if (IfSetOption && IsGeometry(arg1) == MagickFalse)
+ arg1=ArgOption("0.0");
+ if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- (void) SetImageOption(_image_info,option+1,ArgOption("0.0"));
+ (void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("bordercolor",option+1) == 0)
SyncImageSettings() used to set per-image attribute.
Used directly by many coders
*/
- if (IfSetOption && IsGeometry(arg1) == MagickFalse)
+ arg1=ArgOption("0.0");
+ if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- (void) SetImageOption(_image_info,option+1,ArgOption("0.0"));
+ (void) SetImageOption(_image_info,option+1,arg1);
break;
}
CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
}
if (LocaleCompare("pointsize",option+1) == 0)
{
- if (IsGeometry(arg1) == MagickFalse)
- CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- _image_info->pointsize=_draw_info->pointsize=
- StringToDouble(ArgOption("12"),(char **) NULL);
+ if (IfSetOption) {
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ _image_info->pointsize =
+ _draw_info->pointsize =
+ StringToDouble(arg1,(char **) NULL);
+ }
+ else {
+ _image_info->pointsize=0.0; /* unset pointsize */
+ _draw_info->pointsize=12.0;
+ }
break;
}
if (LocaleCompare("precision",option+1) == 0)
{
- (void) SetMagickPrecision(StringToInteger(ArgOption("-1")));
+ arg1=ArgOption("-1");
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ (void) SetMagickPrecision(StringToInteger(arg1));
break;
}
/* FUTURE: Only the 'preview' coder appears to use this
{
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ _image_info->quality= IfSetOption ? StringToUnsignedLong(arg1)
+ : UNDEFINED_COMPRESSION_QUALITY;
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
- _image_info->quality=UNDEFINED_COMPRESSION_QUALITY;
- if (IfSetOption)
- _image_info->quality=StringToUnsignedLong(arg1);
break;
}
if (LocaleCompare("quantize",option+1) == 0)
}
if (LocaleCompare("quiet",option+1) == 0)
{
- /* FUTURE: if two -quiet is performed you can not do +quiet! */
+ /* FUTURE: if two -quiet is performed you can not do +quiet!
+ This needs to be checked over thoughly.
+ */
static WarningHandler
warning_handler = (WarningHandler) NULL;
Used by many coders
SyncImageSettings() used to set per-image attribute.
*/
- if (IfSetOption && IsGeometry(arg1) == MagickFalse)
+ arg1=ArgOption("0.0");
+ if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- (void) SetImageOption(_image_info,option+1,ArgOption("0.0"));
+ (void) SetImageOption(_image_info,option+1,arg1);
break;
}
if (LocaleCompare("render",option+1) == 0)
if (LocaleCompare("sampling-factor",option+1) == 0)
{
/* FUTURE: should be converted to jpeg:sampling_factor */
+ if (IfSetOption && IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) CloneString(&_image_info->sampling_factor,ArgOption(NULL));
break;
}
if (LocaleCompare("scene",option+1) == 0)
{
- /* SyncImageSettings() used to set per-image attribute.
+ /* SyncImageSettings() used to set this as a per-image attribute.
What ??? Why ????
*/
+ if (IfSetOption && IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
_image_info->scene=StringToUnsignedLong(ArgOption("0"));
break;
}
if (LocaleCompare("seed",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
SeedPseudoRandomGenerator(
IfSetOption ? (size_t) StringToUnsignedLong(arg1)
: (size_t) time((time_t *) NULL) );
}
if (LocaleCompare("stretch",option+1) == 0)
{
- _draw_info->stretch=(StretchType) ParseCommandOption(
- MagickStretchOptions,MagickFalse,ArgOption("undefined"));
+ arg1=ArgOption("undefined");
+ parse = ParseCommandOption(MagickStretchOptions,MagickFalse,arg1);
+ if (parse < 0)
+ CLIWandExceptArgBreak(OptionError,"UnrecognizedStretchType",
+ option,arg1);
+ _draw_info->stretch=(StretchType) parse;
break;
}
if (LocaleCompare("stroke",option+1) == 0)
}
if (LocaleCompare("strokewidth",option+1) == 0)
{
+ if (IfSetOption && IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
_draw_info->stroke_width=StringToDouble(ArgOption("1.0"),
(char **) NULL);
}
if (LocaleCompare("style",option+1) == 0)
{
- _draw_info->style=(StyleType) ParseCommandOption(MagickStyleOptions,
- MagickFalse,ArgOption("undefined"));
+ arg1=ArgOption("undefined");
+ parse = ParseCommandOption(MagickStyleOptions,MagickFalse,arg1);
+ if (parse < 0)
+ CLIWandExceptArgBreak(OptionError,"UnrecognizedStyleType",
+ option,arg1);
+ _draw_info->style=(StyleType) parse;
break;
}
if (LocaleCompare("synchronize",option+1) == 0)
{
+ /* FUTURE: syncronize to storage - but what does that mean? */
_image_info->synchronize = ArgBoolean;
break;
}
angle;
if (IfPlusOp) {
- RandomInfo
- *random_info;
+ RandomInfo
+ *random_info;
- random_info=AcquireRandomInfo();
- angle=22.5*(GetPseudoRandomValue(random_info)-0.5);
- random_info=DestroyRandomInfo(random_info);
- }
+ random_info=AcquireRandomInfo();
+ angle=22.5*(GetPseudoRandomValue(random_info)-0.5);
+ random_info=DestroyRandomInfo(random_info);
+ }
else {
- if (IsGeometry(arg1) == MagickFalse)
- CLIWandExceptArgBreak(OptionError,"InvalidArgument",option
- ,arg1);
- flags=ParseGeometry(arg1,&geometry_info);
- angle=geometry_info.rho;
- }
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ flags=ParseGeometry(arg1,&geometry_info);
+ angle=geometry_info.rho;
+ }
caption=GetImageProperty(_image,"caption",_exception);
new_image=PolaroidImage(_image,_draw_info,caption,angle,
_image->interpolate,_exception);
{
if (LocaleCompare("radial-blur",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
new_image=RadialBlurImage(_image,geometry_info.rho,
geometry_info.sigma,_exception);
}
if (LocaleCompare("raise",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParsePageGeometry(_image,arg1,&geometry,_exception);
if ((flags & SigmaValue) == 0)
geometry.height=geometry.width;
}
if (LocaleCompare("random-threshold",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) RandomThresholdImage(_image,arg1,_exception);
break;
}
if (LocaleCompare("repage",option+1) == 0)
{
if (IfNormalOp)
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ResetImagePage(_image,arg1);
else
(void) ParseAbsoluteGeometry("0x0+0+0",&_image->page);
}
if (LocaleCompare("resample",option+1) == 0)
{
- /* FUTURE: remove blur arguemnt - no longer used */
+ /* FUTURE: remove blur arguemnt - no longer used
+ Roll into a resize special operation */
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=geometry_info.rho;
if (LocaleCompare("resize",option+1) == 0)
{
/* FUTURE: remove blur argument - no longer used */
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ParseRegionGeometry(_image,arg1,&geometry,_exception);
new_image=ResizeImage(_image,geometry.width,geometry.height,
_image->filter,_image->blur,_exception);
}
if (LocaleCompare("roll",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ParsePageGeometry(_image,arg1,&geometry,_exception);
new_image=RollImage(_image,geometry.x,geometry.y,_exception);
break;
}
if (LocaleCompare("rotate",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
if (strchr(arg1,'>') != (char *) NULL)
if (_image->columns <= _image->rows)
break;
if (strchr(arg1,'<') != (char *) NULL)
if (_image->columns >= _image->rows)
break;
-
(void) ParseGeometry(arg1,&geometry_info);
new_image=RotateImage(_image,geometry_info.rho,_exception);
break;
if (LocaleCompare("sample",option+1) == 0)
{
/* FUTURE: Roll into a resize special operator */
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ParseRegionGeometry(_image,arg1,&geometry,_exception);
new_image=SampleImage(_image,geometry.width,geometry.height,
_exception);
if (LocaleCompare("scale",option+1) == 0)
{
/* FUTURE: Roll into a resize special operator */
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ParseRegionGeometry(_image,arg1,&geometry,_exception);
new_image=ScaleImage(_image,geometry.width,geometry.height,
_exception);
break;
}
+ if (LocaleCompare("segment",option+1) == 0)
+ {
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ flags=ParseGeometry(arg1,&geometry_info);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=1.0;
+ (void) SegmentImage(_image,_image->colorspace,
+ _image_info->verbose,geometry_info.rho,geometry_info.sigma,
+ _exception);
+ break;
+ }
if (LocaleCompare("selective-blur",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & PercentValue) != 0)
geometry_info.xi=(double) QuantumRange*geometry_info.xi/100.0;
}
if (LocaleCompare("sepia-tone",option+1) == 0)
{
- double
- threshold;
-
- threshold=StringToDoubleInterval(arg1,(double) QuantumRange+1.0);
- new_image=SepiaToneImage(_image,threshold,_exception);
- break;
- }
- if (LocaleCompare("segment",option+1) == 0)
- {
- flags=ParseGeometry(arg1,&geometry_info);
- if ((flags & SigmaValue) == 0)
- geometry_info.sigma=1.0;
- (void) SegmentImage(_image,_image->colorspace,
- _image_info->verbose,geometry_info.rho,geometry_info.sigma,
- _exception);
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ new_image=SepiaToneImage(_image,StringToDoubleInterval(arg1,
+ (double) QuantumRange+1.0),_exception);
break;
}
if (LocaleCompare("set",option+1) == 0)
char
*value;
- if (IfPlusOp)
- {
+ if (IfPlusOp) {
if (LocaleNCompare(arg1,"registry:",9) == 0)
(void) DeleteImageRegistry(arg1+9);
else
(void) DeleteImageProperty(_image,arg1);
break;
}
- value=InterpretImageProperties(_image_info,_image,arg2,
- _exception);
+ value=InterpretImageProperties(_image_info,_image,arg2,_exception);
if (value == (char *) NULL)
break;
if (LocaleNCompare(arg1,"registry:",9) == 0)
- (void) SetImageRegistry(StringRegistryType,arg1+9,value,
- _exception);
+ (void) SetImageRegistry(StringRegistryType,arg1+9,value,_exception);
else
if (LocaleNCompare(arg1,"option:",7) == 0)
{
}
if (LocaleCompare("shade",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
}
if (LocaleCompare("shadow",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
}
if (LocaleCompare("sharpen",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
}
if (LocaleCompare("shave",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParsePageGeometry(_image,arg1,&geometry,_exception);
new_image=ShaveImage(_image,&geometry,_exception);
break;
}
if (LocaleCompare("shear",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=geometry_info.rho;
}
if (LocaleCompare("sigmoidal-contrast",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=(double) QuantumRange/2.0;
}
if (LocaleCompare("sketch",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
}
if (LocaleCompare("solarize",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) SolarizeImage(_image,StringToDoubleInterval(arg1,(double)
QuantumRange+1.0),_exception);
break;
}
if (LocaleCompare("sparse-color",option+1) == 0)
{
- SparseColorMethod
- method;
-
char
*arguments;
- method=(SparseColorMethod) ParseCommandOption(
- MagickSparseColorOptions,MagickFalse,arg1);
+ parse= ParseCommandOption(MagickSparseColorOptions,MagickFalse,arg1);
+ if ( parse < 0 )
+ CLIWandExceptArgBreak(OptionError,"UnrecognizedSparseColorMethod",
+ option,arg1);
arguments=InterpretImageProperties(_image_info,_image,arg2,_exception);
if (arguments == (char *) NULL)
- break;
- new_image=SparseColorOption(_image,method,arguments,_exception);
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg2);
+ new_image=SparseColorOption(_image,(SparseColorMethod)parse,
+ arguments,_exception);
arguments=DestroyString(arguments);
break;
}
if (LocaleCompare("splice",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ParseGravityGeometry(_image,arg1,&geometry,_exception);
new_image=SpliceImage(_image,&geometry,_exception);
break;
}
if (LocaleCompare("spread",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ParseGeometry(arg1,&geometry_info);
new_image=SpreadImage(_image,geometry_info.rho,_image->interpolate,
_exception);
{
parse=ParseCommandOption(MagickStatisticOptions,MagickFalse,arg1);
if ( parse < 0 )
- CLIWandExceptArgBreak(OptionError,"UnrecognizedFunction",
+ CLIWandExceptArgBreak(OptionError,"UnrecognizedStatisticType",
option,arg1);
if (IsGeometry(arg2) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg2);
}
if (LocaleCompare("swirl",option+1) == 0)
{
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
(void) ParseGeometry(arg1,&geometry_info);
new_image=SwirlImage(_image,geometry_info.rho,
_image->interpolate,_exception);
{
if (LocaleCompare("remap",option+1) == 0)
{
- (void) RemapImages(_quantize_info,_images,(Image *) NULL,_exception);
(void) RemapImages(_quantize_info,_images,(Image *) NULL,_exception);
break;
}
ssize_t
offset;
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
offset=(ssize_t) StringToLong(arg1);
smush_image=SmushImages(_images,normal_op,offset,_exception);
if (smush_image == (Image *) NULL)
index,
swap_index;
+ if (IsGeometry(arg1) == MagickFalse)
+ CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
index=-1;
swap_index=-2;
if (IfNormalOp)
p=GetImageFromList(_images,index);
q=GetImageFromList(_images,swap_index);
if ((p == (Image *) NULL) || (q == (Image *) NULL))
- {
- (void) ThrowMagickException(_exception,GetMagickModule(),
- OptionError,"NoSuchImage","'%s'",_images->filename);
- break;
- }
+ CLIWandExceptArgBreak(OptionError,"NoSuchImage",option,arg1);
if (p == q)
- break;
+ break; /* same image - no-op - not an error */
swap=CloneImage(p,0,0,MagickTrue,_exception);
ReplaceImageInList(&p,CloneImage(q,0,0,MagickTrue,_exception));
ReplaceImageInList(&q,swap);
_exception);
if (LocaleCompare("respect-parenthesis",option+1) == 0) {
- /* image-setting stack linkage */
+ /* link image and setting stacks - option is itself saved on stack! */
(void) SetImageOption(cli_wand->wand.image_info,option+1,
*option == '-' ? "true" : (char *) NULL);
return;
cli_wand->image_list_stack = node;
/* handle respect-parenthesis */
- if ( IsMagickTrue(GetImageOption(cli_wand->wand.image_info,
+ if (IsMagickTrue(GetImageOption(cli_wand->wand.image_info,
"respect-parenthesis")) != MagickFalse )
- option="{"; /* push image settings too */
+ option="{"; /* fall-thru so as to push image settings too */
else
return;
}
{
if (IsMagickTrue(GetImageOption((ImageInfo *)node->data,
"respect-parenthesis")) != MagickFalse )
- option="}"; /* pop image settings too */
+ option="}"; /* fall-thru so as to pop image settings too */
else
return;
}