MultiplyConstant function does accept double-valued input parameters, it adheres to the image’s pixel type (double valued input has simply been chosen here because it is a good match to cover all the plausible pixel data types; after all, we unfortunately cannot use function overloading in the C-API…).
Therefore, if you multiply an image with 8 bit unsigned integer pixels by 0.5, you effectively multiply it by zero because the factors are cast to the data type of the image’s pixels prior to the multiplication.
There are, however, two ways of achieving what you’re after:
- Instead of multiplying by 0.5 you might as well call either
DivideConstant with an input value of 2 or
DownShift with an input of 1. Both operations do the same: They’ll halve the intensity of all pixels.
- If the 0.5 you mentioned was just a placeholder for an arbitrary factor between 0 and 1 then you’ll be better off converting your source image (with integer pixels) into an image with floating-point-valued pixels.
ConvertoTo32BPPFloat will do that for you. With such an image, you should be able to use
MultiplyConstant with non-integer constants without any problems. Once your calculations are done you can go back to the original data type using
ConvertTo8BPPUnsigned. (By the way: Please note that the display is able to directly render floating-point valued images as long as DirectDraw rendering has been switched off).
I hope that helps. The statement in the documentation about negative values reducing intensity is a copy paste error (seems like that got copied over from the
AddConstant description) - sorry for that and thanks for pointing it out!