(11-22-2025, 07:27 AM)SMcNeill Wrote: You need to catch up with QB64PE's capabilities. Here's all it takes to toggle from 32-bit to 256 colors:
Code: (Select All)Screen _NewImage(800, 600, 32)
nature = _LoadImage("nature.jpg", 32)
nature256 = _LoadImage("nature.jpg", 256)
nature256a = _LoadImage("nature.jpg", 257)
Do
Cls , 0
k = _KeyHit
Select Case k
Case 27: System 'escape to end
Case 19712, 18432: Color32 = Color32 + 1 'right/up
Case 19200, 20480: Color32 = Color32 - 1 'left/down
End Select
If Color32 < 0 Then Color32 = 2
If Color32 > 2 Then Color32 = 0
Select Case Color32
Case 0: _PutImage , nature: Print "32-bit"
Case 1: _PutImage , nature256: Print "256-color QB64 set palette"
Case 2: _PutImage , nature256a: Print "256-color adaptive palette"
End Select
_Limit 30
_Display
Loop
Save image below as "nature.jpg".
Steve, this is a great capability in the language libraries.
It's very convenient for games and also for prototyping
more advanced Image processing !
There are still reasons to roll your own code here.
I get much better 8 bit images by allowing ImageMagick to do the palette mapping and dithering and then setting
The 8 bit image palette with _palettecolor. for the Image Handle.
The QB64 set color palette actually kinda sucks

