Skip to content

brightness-contrast unintuitive #6079

@Harry79

Description

@Harry79

ImageMagick version

7.0.10-24

Operating system

Windows

Operating system, version and so on

11

Description

ImageMagick has the brightness-contrast command line option which is quite unintuitive for non-obvious reasons.

Had to look up the implementation to find how it actually is producing the results it outputs.

MagickCore/enhance.c in BrightnessContrastImage:

slope=tan((double) (MagickPI*(alpha/100.0+1.0)/4.0));

I would propose the following more intuitive definition by attaching it to the histogram:

  • +50 would have slope 2 so all input values would be mapped to half of the output value range.
  • -50 would do the opposite, half the input values would be mapped to the full output value range.

more formally:

slope = contrast/100+1 if contrast < 0
slope = 100/(100-contrast) else

Steps to Reproduce

magick convert test.ppm -brightness-contrast 6x-20 out.ppm

Images

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions