{ "-maximum", 0L, DeprecateOptionFlag | FireOptionFlag, MagickTrue },
{ "+median", 1L, DeprecateOptionFlag, MagickTrue },
{ "-median", 1L, ReplacedOptionFlag | SimpleOperatorOptionFlag | FireOptionFlag, MagickTrue },
- { "+metric", 0L, NonMagickOptionFlag, MagickFalse },
- { "-metric", 1L, NonMagickOptionFlag, MagickFalse },
+ { "+metric", 0L, ImageInfoOptionFlag, MagickFalse },
+ { "-metric", 1L, ImageInfoOptionFlag, MagickFalse },
{ "+minimum", 0L, DeprecateOptionFlag | FireOptionFlag, MagickTrue },
{ "-minimum", 0L, DeprecateOptionFlag | FireOptionFlag, MagickTrue },
{ "+mode", 1L, NonMagickOptionFlag, MagickFalse },
{ "-strokewidth", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse },
{ "+style", 0L, DrawInfoOptionFlag, MagickFalse },
{ "-style", 1L, DrawInfoOptionFlag, MagickFalse },
- { "+subimage-search", 0L, NonMagickOptionFlag | ImageInfoOptionFlag, MagickFalse },
- { "-subimage-search", 0L, NonMagickOptionFlag | ImageInfoOptionFlag, MagickFalse },
+// { "+subimage-search", 0L, NonMagickOptionFlag | ImageInfoOptionFlag, MagickFalse },
+// { "-subimage-search", 0L, NonMagickOptionFlag | ImageInfoOptionFlag, MagickFalse },
+ { "-subimage", 0L, ListOperatorOptionFlag, MagickFalse },
{ "+swap", 0L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse },
{ "-swap", 1L, ListOperatorOptionFlag | FireOptionFlag, MagickFalse },
{ "+swirl", 1L, DeprecateOptionFlag, MagickTrue },
(void) QueryColorCompliance(ArgOption(MatteColor),AllCompliance,
&_image_info->matte_color,_exception);
break;
- }
+ }
if (LocaleCompare("metric",option+1) == 0)
{
/* FUTURE: this is only used by CompareImages() which is used
CLIWandExceptArgBreak(OptionError,"UnrecognizedMetricType",
option,arg1);
(void) SetImageOption(_image_info,option+1,ArgOption(NULL));
+ break;
}
if (LocaleCompare("monitor",option+1) == 0)
{
_draw_info->style=(StyleType) parse;
break;
}
+#if 0
if (LocaleCompare("subimage-search",option+1) == 0)
{
/* FUTURE: this is only used by CompareImages() which is used
(void) SetImageOption(_image_info,option+1,ArgBooleanString);
break;
}
+#endif
if (LocaleCompare("synchronize",option+1) == 0)
{
/* FUTURE: syncronize to storage - but what does that mean? */
{
if (LocaleCompare("smush",option+1) == 0)
{
- Image
- *smush_image;
-
+ /* FUTURE: this option needs more work to make better */
ssize_t
offset;
if (IfMagickFalse(IsGeometry(arg1)))
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
offset=(ssize_t) StringToLong(arg1);
- smush_image=SmushImages(_images,normal_op,offset,_exception);
- if (smush_image == (Image *) NULL)
- break;
- _images=DestroyImageList(_images);
- _images=smush_image;
+ new_images=SmushImages(_images,normal_op,offset,_exception);
+ break;
+ }
+ if (LocaleCompare("subimage",option+1) == 0)
+ {
+ Image
+ *base_image,
+ *compare_image;
+
+ const char *
+ value;
+
+ MetricType
+ metric;
+
+ double
+ similarity;
+
+ RectangleInfo
+ offset;
+
+ base_image=GetImageFromList(_images,0);
+ compare_image=GetImageFromList(_images,1);
+
+ /* Comparision Metric */
+ metric=UndefinedMetric;
+ value=GetImageOption(_image_info,"metric");
+ if (value != (const char *) NULL)
+ metric=(MetricType) ParseCommandOption(MagickMetricOptions,
+ MagickFalse,value);
+
+ new_images=SimilarityImage(base_image,compare_image,metric,
+ &offset,&similarity,_exception);
+
+ if ( new_images != (Image *)NULL ) {
+ char
+ result[MaxTextExtent];
+
+ (void) FormatLocaleString(result,MaxTextExtent,"%lf",similarity);
+ (void) SetImageProperty(new_images,"subimage:similarity",result,
+ _exception);
+ (void) FormatLocaleString(result,MaxTextExtent,"%+ld",
+ (long) offset.x);
+ (void) SetImageProperty(new_images,"subimage:x",result,
+ _exception);
+ (void) FormatLocaleString(result,MaxTextExtent,"%+ld",
+ (long) offset.y);
+ (void) SetImageProperty(new_images,"subimage:y",result,
+ _exception);
+ (void) FormatLocaleString(result,MaxTextExtent,"%lux%lu%+ld%+ld",
+ (unsigned long) offset.width,(unsigned long) offset.height,
+ (long) offset.x,(long) offset.y);
+ (void) SetImageProperty(new_images,"subimage:offset",result,
+ _exception);
+ }
break;
}
if (LocaleCompare("swap",option+1) == 0) {