x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

2bp specifications

Moderators: C:Amie

Jump to page : 1 2
Now viewing page 2 [15 messages per page]

smb_gaiden Page Icon Posted 2020-05-13 11:45 PM
#
Avatar image of smb_gaiden
Factorite (Elite)

Posts:
204
Status:
Quote
Karpour - 2020-05-13 2:45 PM

Quote
smb_gaiden - 2020-05-13 4:55 PM
They either start at the bottom or the top based on whether biHeight is positive or negative. Your app will want to do the same or risk inadvertently inverting some images.


That's good to know, thanks! So in the current image biHeight is positive, and the scan rows are bottom to top, is that how it's supposed to be?


Yes, that's right. And it seems I got the term wrong OR I used the word scan row in my code

https://docs.microsoft.com/en-us/windows/win32/directshow/top-down-v...

They call it stride.
 Top of the page
Karpour Page Icon Posted 2020-05-15 11:51 AM
#
Avatar image of Karpour
Subscribers
Factorite (Elite)

Posts:
232
Location:
Austria
Status:
So it turns out that according to MSDN, 2bp is a valid Bitmap: https://docs.microsoft.com/en-us/previous-versions/ms959648(v=msdn.10)?redirectedfrom=MSDN
Which means all libraries that claim to properly parse all Windows bitmaps and can't do 2bpp are wrong!
 Top of the page
ShadowMaster Page Icon Posted 2020-05-15 5:45 PM
#
Avatar image of ShadowMaster
Subscribers
H/PC Philosopher

Posts:
277
Location:
Chile
Status:
Quote
Karpour - 2020-05-15 6:51 AM

So it turns out that according to MSDN, 2bp is a valid Bitmap: https://docs.microsoft.com/en-us/previous-versions/ms959648(v=msdn.10)?redirectedfrom=MSDN
Which means all libraries that claim to properly parse all Windows bitmaps and can't do 2bpp are wrong!


Haha I like your logic.
It's a real pity when old encodings are no longer supported, even when they still make sense within the format. I mean, chances are that old encodings are simpler than whatever they support now in there.
 Top of the page
smb_gaiden Page Icon Posted 2020-05-15 8:15 PM
#
Avatar image of smb_gaiden
Factorite (Elite)

Posts:
204
Status:
Quote
ShadowMaster - 2020-05-15 9:45 AM

Quote
Karpour - 2020-05-15 6:51 AM

So it turns out that according to MSDN, 2bp is a valid Bitmap: https://docs.microsoft.com/en-us/previous-versions/ms959648(v=msdn.10)?redirectedfrom=MSDN
Which means all libraries that claim to properly parse all Windows bitmaps and can't do 2bpp are wrong!


Haha I like your logic.
It's a real pity when old encodings are no longer supported, even when they still make sense within the format. I mean, chances are that old encodings are simpler than whatever they support now in there.


It's actually surprising they don't support 2 bits. This can pull a pixel from any depth of 1,2,4, or 8.
bit = ((cb>>(8-(depth*(i+1))))&0xFF)&((1<<depth)-1);
 Top of the page
Karpour Page Icon Posted 2020-05-16 9:39 PM
#
Avatar image of Karpour
Subscribers
Factorite (Elite)

Posts:
232
Location:
Austria
Status:
Here we go, my first 2bp, converted from 2bp to 4bp bitmap

App supports piped input and output as well, so it can be plugged right into imagemagick and other tools

thomas@SURFY:/mnt/c/Users/Thomas/Code/js-2bp$ ts-node ./src/convert2bp.ts -h 
usage: convert2bp.ts [-h] [-v] [-o OUTPUTFILE] [-f] [INPUTFILE] 
 
2bp to BMP converter 
 
Positional arguments: 
  INPUTFILE             File to convert. File can also be piped into process 
 
Optional arguments: 
  -h, --help            Show this help message and exit. 
  -v, --version         Show program's version number and exit. 
  -o OUTPUTFILE, --output-file OUTPUTFILE 
                        Converts a 2bp image to a 4bpp bmp file 
  -f, --force           Converts a 2bp image to a 4bpp bmp file 
thomas@SURFY:/mnt/c/Users/Thomas/Code/js-2bp$ ts-node ./src/convert2bp.ts < ./test.2bp > test.bmp 
thomas@SURFY:/mnt/c/Users/Thomas/Code/js-2bp$ ts-node ./src/convert2bp.ts -f -o ./test.bmp ./test.2bp






(out.bmp)



Attachments
----------------
Attachments out.bmp (0KB - 1 downloads)
 Top of the page
hpc:factor« View previous thread · Developers Arena · View next thread »

Jump to page : 1 2
Now viewing page 2 [15 messages per page]

Jump to forum:
Seconds to generate: 0.043 - Cached queries : 61 - Executed queries : 9
Server Time now is: Tuesday, 22 September 2020 - 13:13