Interpretation of raster data

Christian Walther cwalther at gmx.ch
Sun Mar 27 05:07:28 PST 2005


I'm writing a raster printer driver (filter) that receives 8-bit-per-pixel CUPS_CSPACE_W grayscale raster data, halftones it to black-and-white, and outputs it in a format suitable for sending to the printer.

What I'm not sure about, and have found nowhere in the documentation, is how to interpret the 8-bit pixel values I get. How do they map to linear intensity? Linearly, e.g. 128 means middle gray, where half of the paper area has to be covered with black? Or encoded through a power function, e.g. 174 means middle gray for an exponent of 1.8? Or anything else?

Is there a global specification for the correct mapping? Or is it different between jobs? If so, how would I find out - the raster header and the options argument don't appear to carry any relevant information?

My experiments on Mac OS X seem to suggest that it is a power function with an exponent of 1.8, just as for the screen. I doubt, however, that relying on this being always true is the proper thing to do.

Thanks for any explanations

 -Christian




More information about the cups-devel mailing list