zagibu Posted May 12, 2008 Share Posted May 12, 2008 I have this large binary blob. It's the pixel information of a 32bit bitmap. I'd like to convert it into 24bit by cutting out every fourth byte of the binary blob. I've had the idea to use BinaryMid($blob, $index, 3) in a loop to get the first three bytes of the blob. But how do I chain all those three-byte pieces together? And how do I cut them out of the blob, so that loop iterations don't get all the same three bytes? Another idea I had was to use BitShift() and BitOR(), but it seems the blob is too large for BitShift()... Link to comment Share on other sites More sharing options...
ProgAndy Posted May 12, 2008 Share Posted May 12, 2008 Des this work? $oldBlob = "0xABCD124EF..." $newBlob= "0x" For $i = 1 To BinaryLen($oldBlob) Step 4 $newBlob &= StringTrimLeft(BinaryMid($oldblob, $i, 3),2) Next $newBlob = Binary($newBlob) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Siao Posted May 12, 2008 Share Posted May 12, 2008 (edited) If you want to keep it pure AutoIt, you are better off working with that binary data as a hex string, and doing StringRegExpReplace. Any kind of looping (including the one suggested by ProgAndy above) will be pathetically slow on any decent sized data. Edited May 12, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now