diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs
index 779d3a4..ca28ca6 100644
--- a/PerlMagick/Magick.xs
+++ b/PerlMagick/Magick.xs
@@ -516,6 +516,9 @@
{"color-correction-collection", StringReference} } },
{ "AutoGamma", { {"channel", MagickChannelOptions} } },
{ "AutoLevel", { {"channel", MagickChannelOptions} } },
+ { "LevelColors", { {"invert", MagickBooleanOptions},
+ {"black-point", RealReference}, {"white-point", RealReference},
+ {"channel", MagickChannelOptions}, {"invert", MagickBooleanOptions} } },
};
static SplayTreeInfo
@@ -6759,6 +6762,8 @@
AutoGammaImage = 254
AutoLevel = 255
AutoLevelImage = 256
+ LevelColors = 257
+ LevelColorsImage = 258
MogrifyRegion = 666
PPCODE:
{
@@ -9939,6 +9944,26 @@
(void) AutoLevelImageChannel(image,channel);
break;
}
+ case 129: /* LevelColors */
+ {
+ MagickPixelPacket
+ black_point,
+ white_point;
+
+ (void) QueryMagickColor("#000000",&black_point,exception);
+ (void) QueryMagickColor("#ffffff",&black_point,exception);
+ if (attribute_flag[1] != 0)
+ (void) QueryMagickColor(argument_list[1].string_reference,
+ &black_point,exception);
+ if (attribute_flag[2] != 0)
+ (void) QueryMagickColor(argument_list[2].string_reference,
+ &white_point,exception);
+ if (attribute_flag[3] != 0)
+ channel=(ChannelType) argument_list[3].long_reference;
+ (void) LevelImageColors(image,channel,&black_point,&white_point,
+ argument_list[0].long_reference != 0 ? MagickTrue : MagickFalse);
+ break;
+ }
}
if (next != (Image *) NULL)
(void) CatchImageException(next);
diff --git a/magick/enhance.c b/magick/enhance.c
index 3e90c65..5f90e66 100644
--- a/magick/enhance.c
+++ b/magick/enhance.c
@@ -2718,9 +2718,9 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% LevelImageColor() will map the given color to "black" and "white"
-% values, limearly spreading out the colors, and level values on a channel by
-% channel bases, as per LevelImage(). The given colors allows you to specify
+% LevelImageColor() 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 seperatally.
%
% If the boolean 'invert' is set true the image values will modifyed in the
@@ -2731,9 +2731,9 @@
%
% The format of the LevelImageColors method is:
%
-% MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
-% const MagickPixelPacket *black_color,const MagickPixelPacket *white_color,
-% const MagickBooleanType invert)
+% MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
+% const MagickPixelPacket *black_color,
+% const MagickPixelPacket *white_color,const MagickBooleanType invert)
%
% A description of each parameter follows:
%
diff --git a/magick/enhance.h b/magick/enhance.h
index a2ca92e..f2759e8 100644
--- a/magick/enhance.h
+++ b/magick/enhance.h
@@ -46,7 +46,7 @@
LevelizeImageChannel(Image *,const ChannelType,const double,const double,
const double),
LevelImageColors(Image *,const ChannelType,const MagickPixelPacket *,
- const MagickPixelPacket *, const MagickBooleanType),
+ const MagickPixelPacket *,const MagickBooleanType),
LinearStretchImage(Image *,const double,const double),
ModulateImage(Image *,const char *),
NegateImage(Image *,const MagickBooleanType),
diff --git a/wand/convert.c b/wand/convert.c
index f633262..aad7de9 100644
--- a/wand/convert.c
+++ b/wand/convert.c
@@ -208,7 +208,7 @@
"-layers method optimize, merge, or compare image layers",
"-level value adjust the level of image contrast",
"-level-colors color,color",
- " level image using given colors",
+ " level image with the given colors",
"-linear-stretch geometry",
" improve contrast by `stretching with saturation'",
"-liquid-rescale geometry",
diff --git a/wand/mogrify.c b/wand/mogrify.c
index 0a39345..c12bf9c 100644
--- a/wand/mogrify.c
+++ b/wand/mogrify.c
@@ -1860,25 +1860,25 @@
p=(const char *) argv[i+1];
GetMagickToken(p,&p,token); /* get black point color */
- if (isalpha((int) token[0]) || (token[0] == '#'))
+ if ((isalpha((int) *token) != 0) || ((*token == '#') != 0))
(void) QueryMagickColor(token,&black_point,exception);
else
- (void) QueryMagickColor("black",&black_point,exception);
+ (void) QueryMagickColor("#000000",&black_point,exception);
if (isalpha((int) token[0]) || (token[0] == '#'))
GetMagickToken(p,&p,token);
- if (token[0] == '\0')
+ if (*token == '\0')
white_point=black_point; /* set everything to that color */
else
{
/*
Get white point color.
*/
- if (!(isalpha((int) token[0]) || (token[0] == '#')))
+ if ((isalpha((int) *token) == 0) && ((*token == '#') == 0))
GetMagickToken(p,&p,token);
- if ((isalpha((int) token[0]) || (token[0] == '#')))
+ if ((isalpha((int) *token) != 0) || ((*token == '#') != 0))
(void) QueryMagickColor(token,&white_point,exception);
else
- (void) QueryMagickColor("white",&white_point,exception);
+ (void) QueryMagickColor("#ffffff",&white_point,exception);
}
(void) LevelImageColors(*image,channel,&black_point,&white_point,
*option == '+' ? MagickTrue : MagickFalse);
@@ -3496,7 +3496,7 @@
"-layers method optimize, merge, or compare image layers",
"-level value adjust the level of image contrast",
"-level-colors color,color",
- " level image using given colors",
+ " level image with the given colors",
"-linear-stretch geometry",
" improve contrast by `stretching with saturation'",
"-liquid-rescale geometry",