LinearStretch() works strange if compared with bin/convert

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
tem
Posts: 2
Joined: 2017-11-06T06:19:20-07:00
Authentication code: 1152

LinearStretch() works strange if compared with bin/convert

Post by tem »

tested on:
ImageMagick7-nox11-7.0.7.4
ImageMagick-nox11-6.9.8.9_1,1

bin/convert manual:
-linear-stretch black-point{xwhite-point}{%}

in perl it would be:
$img->LinearStretch('levels' => AxB, 'black-point' => double, 'white-point' => double);

the results are different and i can't make any arguments for LinearStretch() for result to match to bin/convert's result.

diff page with images:
http://zznine.com/convert-linear-stretch/diff.html

Question:
what should be arguments for LinearStretch() to match:
1) bin/convert -linear-stretch AxB
2) bin/convert -linear-stretch AxB%
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: LinearStretch() works strange if compared with bin/convert

Post by snibgo »

I don't use Perl, but looking at Magick.xs, I think the first part ("rho") of the string argument is ignored. So if you have "levels=30%x70%", the 30% is ignored, and zero is used for the black point. It looks as if "black-point" and "white-point" should work, but they need to be the number of pixels, not a percentage.
snibgo's IM pages: im.snibgo.com
tem
Posts: 2
Joined: 2017-11-06T06:19:20-07:00
Authentication code: 1152

Re: LinearStretch() works strange if compared with bin/convert

Post by tem »

if bin/convert can calculate % for both black and white argument, it should be the same for perl.
So it would do "the same" image transformation as bin/convert.
Otherwise it is confusing.
Post Reply