Page 1 of 1

contrast-stretch questions

Posted: 2007-07-30T11:36:45-07:00
by jbrandon5
I have some error-difference images with very small errors, so they show up as just black. I want to stretch the low-end range so that the errors become visible.

The -normalize option works for this, and makes the largest error value show up as white. However, I want to adjust all the images by the same value, so I was trying to do this with -contrast-stretch.

The documentation is a bit confusing for the option - can anyone help explain what the values mean for -contrast-stretch? Also, what is the difference from -linear-stretch?

Re: contrast-stretch questions

Posted: 2007-08-09T22:36:30-07:00
by anthony
-contrast-stretch and -normalize are the same function.
By defalt normalize find the highest and lowest color value in any RGB channel
then moves inward by 1% of the color range (to account for JPEG 'ringing' color distortions) At this point all three color channels are then stretched.
The contrast-stretch does the same thing but you can specify the amount of inward movement. often it is used with a '0' argument to prevent color 'clipping'.

For exact controls, you can either use -linear-stretch which you provide a percentage to move the black and white point inward by. Or -level which directly defines the color levels.

Of course you can also use your own histogram adjsutment function via -fx

See IM Examples, Color Modifications.

Note... Fred Weinhaus, is currently working on a new set of general histogram handling methods, as a series of shell scripts. These will eventually be built into IM to revolutionize general color controls within IM.

This includes... linear stretching and de-contrast handling, auto-leveling using various methods to select the black and white points which is more like the photoshop/gimp auto-leveling methods. LUT histogram color replacements and 'curves' using various methods of fitting the functions to control points. and probably lots more.