2011-03-14 6.6.8-6 Cristy <quetzlzacatenango@image...>
* Fixed memory leak for PDF and Bitmap PSD RLE support (reference
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=18317).
+ * Support the -statistic option: replace each pixel with corresponding
+ statistic from the neighborhood.
2011-03-17 6.6.8-5 Anthony Thyssen <A.Thyssen@griffith...>
* Replaced Minus and Divide Composition methods with Dst and Src
{ "ColorMatrix", { {"matrix", ArrayReference} } },
{ "Color", { {"color", StringReference} } },
{ "Mode", { {"radius", RealReference} } }
+ { "Statistic", { {"radius", RealReference},
+ {"channel", MagickChannelOptions}, {"type", MagickStatisticOptions} } }
};
static SplayTreeInfo
ColorImage = 270
Mode = 271
ModeImage = 272
+ Statistic = 273
+ StatisticImage = 274
MogrifyRegion = 666
PPCODE:
{
image=ModeImage(image,argument_list[0].real_reference,exception);
break;
}
+ case 137: /* Statistic */
+ {
+ StatisticType
+ statistic;
+
+ statistic=UndefinedStatistic;
+ if (attribute_flag[0] == 0)
+ argument_list[0].real_reference=0.0;
+ if (attribute_flag[1] != 0)
+ channel=(ChannelType) argument_list[1].integer_reference;
+ if (attribute_flag[2] != 0)
+ statistic=(StatisticType) argument_list[2].integer_reference;
+ image=StatisicImageChannel(image,channel,statistic,
+ argument_list[0].real_reference,exception);
+ break;
+ }
}
if (next != (Image *) NULL)
(void) CatchImageException(next);
{
UndefinedStatistic,
MaximumStatistic,
+ MeanStatistic,
MedianStatistic,
MinimumStatistic,
ModeStatistic,
{
{ "Undefined", (ssize_t) UndefinedStatistic, MagickTrue },
{ "Maximum", (ssize_t) MaximumStatistic, MagickFalse },
+ { "Mean", (ssize_t) MeanStatistic, MagickFalse },
{ "Median", (ssize_t) MedianStatistic, MagickFalse },
{ "Minimum", (ssize_t) MinimumStatistic, MagickFalse },
{ "Mode", (ssize_t) ModeStatistic, MagickFalse },
% %
% %
% %
+% M a g i c k S t a t i s t i c I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MagickStatisticImage() replace each pixel with corresponding statistic from
+% the neighborhood of the specified radius.
+%
+% The format of the MagickStatisticImage method is:
+%
+% MagickBooleanType MagickStatisticImage(MagickWand *wand,
+% const StatisticType type,const double radius)
+% MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
+% const ChannelType channel,const StatisticType type,const double radius)
+%
+% A description of each parameter follows:
+%
+% o wand: the magick wand.
+%
+% o channel: the image channel(s).
+%
+% o type: the statistic type (e.g. median, mode, etc.).
+%
+% o radius: the radius of the pixel neighborhood.
+%
+*/
+WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
+ const ChannelType channel,const StatisticType type,const double radius)
+{
+ Image
+ *statistic_image;
+
+ assert(wand != (MagickWand *) NULL);
+ assert(wand->signature == WandSignature);
+ if (wand->debug != MagickFalse)
+ (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+ if (wand->images == (Image *) NULL)
+ ThrowWandException(WandError,"ContainsNoImages",wand->name);
+ statistic_image=StatisticImageChannel(wand->images,channel,type,radius,
+ wand->exception);
+ if (statistic_image == (Image *) NULL)
+ return(MagickFalse);
+ ReplaceImageInList(&wand->images,statistic_image);
+ return(MagickTrue);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% M a g i c k S t e g a n o I m a g e %
% %
% %
MagickSpliceImage(MagickWand *,const size_t,const size_t,const ssize_t,
const ssize_t),
MagickSpreadImage(MagickWand *,const double),
+ MagickStatisticImage(MagickWand *,const ChannelType,const StatisticType,
+ const double),
+ MagickStatisticImageChannel(MagickWand *,const StatisticType,const double),
MagickStripImage(MagickWand *),
MagickSwirlImage(MagickWand *,const double),
MagickTintImage(MagickWand *,const PixelWand *,const PixelWand *),