hopefully correct implementation of PutImageLUT