Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detecting color depth-16 color, 256 color, or 32 bit color
#7
I modified the code a bit so you don't need to use SCREEN to get the color depth of the images.

Code: (Select All)
DIM a(3)
a(1) = _NEWIMAGE(640, 480, 32)
a(2) = _NEWIMAGE(640, 480, 256)
a(3) = _NEWIMAGE(640, 480, 12)
FOR i = 1 TO 3
    SELECT CASE _PIXELSIZE(a(i))
        CASE 4: PRINT "32-bit color"
        CASE 1:
            cu = 0
            FOR j = 0 TO 255
                IF _PALETTECOLOR(j, a(i)) <> &HFF000000 THEN cu = cu + 1
            NEXT
            SELECT CASE cu
                CASE IS <= 16: PRINT "16 color image"
                CASE ELSE: PRINT "256 color image"
            END SELECT
    END SELECT
    SLEEP
NEXT
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: Detecting color depth-16 color, 256 color, or 32 bit color - by TerryRitchie - 08-16-2024, 05:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question using $color:32 colour names mid-program? hskakw 2 213 01-14-2026, 09:30 AM
Last Post: hskakw
Question Latest version of QB64PE or QB64 compatible with Windows XP (32-bit)? madscijr 14 2,032 09-30-2025, 08:10 AM
Last Post: hsiangch_ong
  Test to post a new Thread + question 32 or 64 bit Rudy M 2 553 09-09-2025, 04:10 PM
Last Post: Rudy M
  useful page: Value of constants for the Windows 32-bit API madscijr 4 695 08-15-2025, 06:35 PM
Last Post: SMcNeill
  _CLEARCOLOR evety color EXCEPT ...? madscijr 4 862 04-27-2025, 10:51 PM
Last Post: TempodiBasic

Forum Jump:


Users browsing this thread: 1 Guest(s)