convert.im - image conversions
out = i_convert(srcimage, coeff, outchans, inchans)
Converts images from one format to another, typically in this case for converting from RGBA to greyscale and back.
Converts the image src into another image.
coeff contains the co-efficients of an outchan x inchan matrix, for each output pixel:
coeff, coeff ... im[x,y] = [ coeff[inchan], coeff[inchan+1]... ] * [ src[x,y], 1] ... coeff[inchan*outchan-1]
If im has the wrong number of channels or is the wrong size then i_convert() will re-create it.
Now handles images with more than 8-bits/sample.
Test if the coefficients represent just copying channels around, and initialize lists of the channels to copy, zero or set to max.
Perform a convert that only requires channel copies.
Tony Cook <firstname.lastname@example.org>