From: Cristy Date: Thu, 11 Jul 2019 11:27:42 +0000 (-0400) Subject: Introducing MagickLevelImageColors() MagickWand method X-Git-Tag: 7.0.8-54~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6584dde8e39b53740942c6a9d6985532a123d584;p=imagemagick Introducing MagickLevelImageColors() MagickWand method --- diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index ff819d0d3..5937c2f72 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -6784,6 +6784,62 @@ WandExport MagickBooleanType MagickLevelImage(MagickWand *wand, % % % % % % +% M a g i c k L e v e l I m a g e C o l o r s % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickLevelImageColors() maps the given color to "black" and "white" values, +% linearly spreading out the colors, and level values on a channel by channel +% bases, as per LevelImage(). The given colors allows you to specify +% different level ranges for each of the color channels separately. +% +% The format of the MagickLevelImageColors method is: +% +% MagickBooleanType MagickLevelImageColors(MagickWand *wand, +% const PixelWand *black_color,const PixelWand *white_color, +% const MagickBooleanType invert) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o black_color: the black color. +% +% o white_color: the white color. +% +% o invert: if true map the colors (levelize), rather than from (level) +% +*/ +WandExport MagickBooleanType MagickLevelImageColors(MagickWand *wand, + const PixelWand *black_color,const PixelWand *white_color, + const MagickBooleanType invert) +{ + MagickBooleanType + status; + + PixelInfo + black, + white; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == MagickWandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + ThrowWandException(WandError,"ContainsNoImages",wand->name); + PixelGetMagickColor(black_color,&black); + PixelGetMagickColor(white_color,&white); + status=LevelImageColors(wand->images,&black,&white,invert,wand->exception); + return(status); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % M a g i c k L e v e l i z e I m a g e % % % % % diff --git a/MagickWand/magick-image.h b/MagickWand/magick-image.h index 3796e6d35..19e3fb8b5 100644 --- a/MagickWand/magick-image.h +++ b/MagickWand/magick-image.h @@ -193,6 +193,8 @@ extern WandExport MagickBooleanType MagickKuwaharaImage(MagickWand *,const double,const double), MagickLabelImage(MagickWand *,const char *), MagickLevelImage(MagickWand *,const double,const double,const double), + MagickLevelImageColors(MagickWand *,const PixelWand *,const PixelWand *, + const MagickBooleanType), MagickLevelizeImage(MagickWand *,const double,const double,const double), MagickLinearStretchImage(MagickWand *,const double,const double), MagickLiquidRescaleImage(MagickWand *,const size_t,const size_t,const double,