[MaxScript] bitmap getPixels -> setPixels wrong rgb Values


#1

Does anyone know why the rgb values change in this (intentionally not optimized) simple script?

in_name = “C:/test.bmp”
out_name = “C:/Users/username/Desktop/testOUT.bmp”
myBitmap = openBitmap in_name
bmWidth = myBitmap.width
bmHeight = myBitmap.height
newBitmap = bitmap bmWidth bmHeight filename:out_name color:white
for i = 0 to (bmHeight-1) do
(
for j = 0 to (bmWidth - 1) do
(
aPixel = getPixels myBitmap [j,i] 1
format “red % , green % , blue %\n” aPixel[1].red aPixel[1].green aPixel[1].blue
setPixels newBitmap [j,i] aPixel
)
)

Output:
red 237.0 , green 28.0 , blue 36.0
red 63.0 , green 72.0 , blue 204.0
red 255.0 , green 242.0 , blue 0.0


#2

Looks like it is gamma corrected.


#3

That’s it! The following lines solve the problem:

fileInGamma = 1.0
fileOutGamma = 1.0