libvips

How to convert 16 bit grayscale image to 8 bit using linear mapping with libvips


I would like to convert a 16 bit grayscale image to 8 bit, where the lowest value of the 16 bit image becomes 0, and the highest becomes 255

As far I can see, I can call vips-hist-norm, which will map it across the full 16 bit range.

However its unclear to me how I can then convert to 8 bit.


Solution

  • vips-scale will perform linear mapping of current type to uchar type.