I propose API and usage for ImageBufAlgo::contrast_stretch.

This function does the same thing as Levels in Photoshop:
http://postimage.org/image/vre9umbqv/
where min_in to max_in is the range of pixel values in
the input image, min_out to max_out is the new range,
values below min_in are mapped to below_min_in and
values above max_in are mapped to above_max_in.
You can see in the image above, Photoshop allows you
to also change gamma, but I think we should have that
as separate function.

1. API:

Modify contrast the same for all channels: http://ideone.com/iVwyA
Modify contrast with different arguments per channel:
http://ideone.com/2kFL7

2. Usage:

./oiiotool in.png --contrast_stretch min_in max_in -o out.png

I expect min_out and max_out to be rarely changed,
since most of the time you want to take a range of values from
the input image and stretch that so that the full min-max range is
used, to get maximum contrast.

I expect below_min_in and above_max_in to be used even less,
so I suggest we have all these as optional parameters:

./oiiotool in.png --contrast_stretch:min_out=float:max_out=float:
below_min_in=float:above_max_in=float min_in max_in -o out.png

It won't be that scary since most of the time you will change 1 or 2 of
those.
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to