Search the Community
Showing results for tags '_winapi_createdib'.
-
I want to take some images and bring their bits down from 32 bits to 8bits(256 colors) and 4 bits (16 colors) searching around for color data, it was easy to get the 4 bits color data and to add it to an array and use the color table $aColorTable= stringsplit('0-8388608-16711680-16711935-32896-32768-65280-65535-128-8388736-255-12632256-8421504-8421376-16776960-16777215','-',3) ; Create color table from an array of colors Local $tColorTable = _WinAPI_CreateDIBColorTable($aColorTable) ; Create 8 bits-per-pixel device-independent bitmap (DIB) and retrieve a pointer to the location of its bit values $hBitmap = _WinAPI_CreateDIB($iWidth, $iHeight, 4, $tColorTable, 16) the result is the same as if i take mspaint load any image and save as 16 colors(4bits) however with the 256 color or 8 bit the data i found are not the same, there are multiple color tables i tested, the colors are off, i even found some scripts in the forum that generate 8 bit color tables but the colors are also off, they are not the same as if i take mspaint and save an image as 256 colors, if done with mspaint the colors are very acculturate, i thought well maybe get the color table from an 8 bit image i have that was done with mspaint, but im not sure how to do that, below i tried something but not sure if it gets the table and i don't know how to get the table to an array #include <WinAPIGdi.au3> #include <WinAPIRes.au3> Global $hBitmap = _WinAPI_LoadImage(0, 'D:\spectrum256.bmp', $IMAGE_BITMAP, 0, 0, $LR_LOADFROMFILE+$LR_CREATEDIBSECTION ) Local $tSIZE = _WinAPI_GetBitmapDimension($hBitmap) Local $iWidth = DllStructGetData($tSIZE, 'X') Local $iHeight = DllStructGetData($tSIZE, 'Y') ConsoleWrite('size= '&$iWidth&' '&$iHeight&@CRLF) $table = _WinAPI_GetDIBColorTable ( $hBitmap) ConsoleWrite(' Error '&@error & @CRLF) ConsoleWrite(' Extended '&@extended & @CRLF) ;_WinAPI_GetDIBits?
- 1 reply
-
- _winapi_createdibcolortable
- _winapi_createdib
- (and 1 more)