'LOADIMAGE256 experimental
'1] Load image as 32 bit image
'2] find how much colors image contains. If 256 and less, continue. If more than 256, return -1 as error message. (can be solved with RhoSigma's ditherring which is a part of SaveImage)
'3] create 8 bit image and color palette
'4] BIG ASK IS: If is this image inserted to 8 bit screen, copy image palette to this screen? OR try to do the same palette for both images?
img8 = LOADIMAGE256("anim1.png")
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