If the image contains only red pixels, ugBASIC will consider red as the background color, and therefore will set the background color of the entire screen as such.If, on the contrary, the image does not have only red pixels (as in the case of token_red.png in the examples) then the fact that only red pixels appear depends on the fact that ugBASIC takes red as the prevailing value, and considers it as the "background color".ldir_hector wrote: ↑Sat Mar 01, 2025 8:28 pm I tried this DLOAD source with a png file of 16*16 pixels only containing red.
The solution is to suggest to ugBASIC not to do any special reasoning, using the EXACT keyword. In this case, it will not reorder the palette by quantity of pixels of that color but will consider the colors "as is". Therefore, since the first pixel is a black pixel, the background will be black and the image will be displayed.
This is the code I suggest to use (it is yours with the EXACT keyword added):
Code: Select all
BITMAP ENABLE(320,200,4)
CLS
STORAGE "disco" AS "disk1"
IMAGE "token_red.png" AS "tokenred" EXACT
ENDSTORAGE
CLS
tokenImage := NEW IMAGE(16, 16)
DLOAD "tokenred" TO VARPTR(tokenImage)
PUT IMAGE tokenImage AT 32, 32
This is the result:

Thank you!