-auto-level does not work

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Jack_Brody
Posts: 2
Joined: 2018-11-25T10:11:38-07:00
Authentication code: 1152

-auto-level does not work

Post by Jack_Brody » 2018-11-25T10:31:55-07:00

I am trying to run:

Code: Select all

magick in.jpg -auto-level out.jpg
I get visually equal image and the histogram does not get stretched. But it is different: the central "peak" is higher so it actually does something.

You may check out my in.jpg and out.jpg here, along with images produced with autolevel functions of XnView and Gimp (these got stretched as expected):

https://www.dropbox.com/sh/5wbrgdmon3v5 ... QujYa?dl=0

Is it a bug or am I doing something wrong?



My system:
Win7 x64 SP1

IM:
Version: ImageMagick 7.0.8-14 Q16 x64 2018-10-24 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC HDRI
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr
lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib

snibgo
Posts: 11816
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -auto-level does not work

Post by snibgo » 2018-11-25T11:32:00-07:00

You are writing to JPEG, which is a lossy format. That means the compression changes pixel values. I suggest you write to a non-lossy format. I expect you will then find the result is as expected.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 25142
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -auto-level does not work

Post by fmw42 » 2018-11-25T11:44:15-07:00

Your image is stretched fully in 2 channels and the other channel min is 9 and max is 255. So you should not expect any change or only a slight change that might not be visible, because global statistics will be used which is 0 and 255. You could do

Code: Select all

convert in.jpg -channel rgb -auto-level out.png
to make each channel stretch to full dynamic range independently.

Jack_Brody
Posts: 2
Joined: 2018-11-25T10:11:38-07:00
Authentication code: 1152

Re: -auto-level does not work

Post by Jack_Brody » 2018-11-25T12:58:57-07:00

That actually does not make much difference as well but it's better a little bit.
But anyway, thank you for your help. I have just found out that -normalize looks like what I need. :)

I kindly ask the administrator to move this thread to a more appropriate section as this apparently is not a bug. Thank you.

Post Reply