-contrast-stretch problem?
Posted: 2008-10-10T16:06:31-07:00
-contrast-stretch doesn't appear to behave as documented when a
non-percent white-point is specified. The documentation says:
tried to convert, not 0 as the doc leads me to expect. This is 6.4.4-3
under Mac OS X 10.4.11.
Assuming the documentation is correct, the patch below looks to do the
job.
Anders
non-percent white-point is specified. The documentation says:
However, -contrast-stretch 0x0 whites-out all pixels in the image IIncrease the contrast in an image by stretching the range of
intensity values. While doing so black-out at most black-point
pixels and white-out at most white-point pixels. Or, if percent is
used, black-out at most black-point % pixels and white-out at most
100% minus white-point% pixels.
tried to convert, not 0 as the doc leads me to expect. This is 6.4.4-3
under Mac OS X 10.4.11.
Assuming the documentation is correct, the patch below looks to do the
job.
Anders
Code: Select all
*** wand/mogrify.c.orig Fri Oct 3 21:34:27 2008
--- wand/mogrify.c Sat Oct 11 00:06:51 2008
***************
*** 914,919 ****
--- 914,922 ----
if ((flags & SigmaValue) == 0)
white_point=(MagickRealType) (*image)->columns*(*image)->rows-
black_point;
+ else if ((flags & PercentValue) == 0)
+ white_point=(MagickRealType) (*image)->columns*(*image)->rows-
+ geometry_info.sigma;
(void) ContrastStretchImageChannel(*image,channel,black_point,
white_point);
InheritException(exception,&(*image)->exception);