Skip to content

Loading 1bit bitmap from byte array #1253

Answered by brianpopow
Int32Overflow asked this question in Q&A
Discussion options

You must be logged in to vote

ImageSharp can decode 1bit bitmaps, but the bitmap needs to have a valid bitmap header (a valid file header and a valid bitmap header). This contains information on how the data has to be interpreted. One example 1bit bitmap would be this

If that's the case for your byte array just use:

using (var image = Image.Load(byteArray))

If that's not the case you would need to prepend a valid bitmap header, but i guess that's too cumbersome.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@antonfirsov
Comment options

@Int32Overflow
Comment options

Answer selected by Int32Overflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1253 on July 03, 2020 08:07.