Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting 24-Bit images to Paletted Images (2-colors to 256-colors)
#2
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".


Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
RE: Converting 24-Bit images to Paletted Images (2-colors to 256-colors) - by SMcNeill - 11-22-2025, 07:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Bright Circle Colors SierraKen 4 625 08-23-2025, 03:33 PM
Last Post: DANILIN
  A little bit of spark fun today TerryRitchie 2 840 05-18-2024, 12:59 AM
Last Post: bobalooie
  _ROL & _ROR A quickie bit of crypto OldMoses 0 521 09-05-2022, 09:36 PM
Last Post: OldMoses
  Load Image 256 Petr 1 752 05-22-2022, 06:19 PM
Last Post: Dav
Video QB64 Win32 Video Player (64 bit) SpriggsySpriggs 6 1,532 04-24-2022, 05:33 PM
Last Post: Dav

Forum Jump:


Users browsing this thread: 1 Guest(s)