img1 = LOADIMAGE256("parrot.png")
DIM palett
(1, 255) AS _UNSIGNED LONG 'first is original palette, second is 0, 255, third is 2, 255
'generate two rando palettes
palett
(0, mask
) = _RGB32(255 - R2
, 255 - G2
, 255 - B2
) 'inverse palette color palett
(1, mask
) = _RGB32(R
, G2
, B2
) 'use original Green and Blue color values in unsigned long palette color value
'set palette for image img2
'set palette for image img2
'set palette for image img3
_PUTIMAGE (0, 50), img1
'place image using original palette
clr8(s) = 99999
test = 0
'this block prevent for writing the same color more than 1x to palette array
test = test + 1
'if is empty place in palette, save this color as next palette color
IF test
> 255 THEN PRINT "Image contains more than 256 colors, can not be directly copyed as 8 bit image":
END clr8(test) = Clr32
'color is saved as palette for 8 bit image
NextColor: p& = p& + 4
'set palette
'create 8 bit mask (set colors 0 to 255 to 8 bit image)
clr~& = clr8(C)
R& = 0
R8& = 0
R& = R& + 4
R8& = R8& + 1