Page 1 of 1

Why does -normalize burn pixels?

Posted: 2007-10-07T17:51:27-07:00
by rling
Should this command line burn pixels?

Code: Select all

convert img.jpg -normalize img-normalized.jpg
If so, what are the formulas it uses, and are these formulas listed in the documentation?

If not, there appears to be a bug in normalize....

img.jpg:
Image

img-normalized.jpg:
Image

Version: ImageMagick 6.3.6 10/01/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

Cheers
rling

Re: Why does -normalize burn pixels?

Posted: 2007-10-09T22:10:40-07:00
by anthony
-normalize is a simple command that fails in your case.

It findes the highest and lowest values in the image, takes off 1% more, then scales all the channels so those values are the maximum/minimum for each channel.
It is rather brain dead.

The problem for you is that 1% Instead you will need to use -contrast-stretch 0%, which works in exactly the same way but lets you specify the about of extra inward color to take off.

That will remove the extra 'burn' you see.

When I have finished work on image distortions I will be looking at the color methods developed by Fred Weinhaus in his IM scripts for auto-levels and other image enhancement. See http://www.fmwconcepts.com/fmw/fmw.html

In the mean time you may like to use his scripts for your images.

Re: Why does -normalize burn pixels?

Posted: 2007-10-09T22:34:55-07:00
by rling
Thanks anthony.
I thought this was a bug in normalize but later worked out that it seemed to be equivalent to -contrast-stretch 1%, and often it looks good. I began to use -contrast-stretch 0 instead. It looks like a lot more than 1% of pixels get burned by normalize but I guess when the dynamic range is small that is what has to happen.

Can the percentage use a decimal point? Seems to not work on Windows, I'm wondering if the command shell is doing something to it since % has special meaning on Windows.

Re: Why does -normalize burn pixels?

Posted: 2007-10-09T23:15:13-07:00
by anthony
It probably can. most arguments are floats. though if your IM is only a Q8 you may have quantization issues. If a percentage is not specified the value is the quality dependant value.