You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However seems like all code that handles opaque pixel formats sets the alpha channel to zero which wasn't the behavior I expected and requires anyone trying to use this library to check whether the input BMP file has an alpha channel and handle it accordingly in their code. The alpha channel of any opaque pixels should be set to 255.
The documentation is also a bit unclear, endianess is pretty confusing when it comes to handling pixels, and since the library by default always decodes the image data to XBGR (because one might expect it's the same as input BMP), I think that the toRGBA option documentation should be clarified, "reverses the pixel byte order from ABGR to RGBA making it compatible with other libraries like pngjs"
Additionally said option is completely ignored if you pass in a palettized image.
For whatever reason, this library gets handling alpha all wrong.
The output
data
buffer seems to store the pixel data as RGBA or ABGR:bmp-ts/src/decoder.ts
Lines 60 to 63 in 2521cce
However seems like all code that handles opaque pixel formats sets the alpha channel to zero which wasn't the behavior I expected and requires anyone trying to use this library to check whether the input BMP file has an alpha channel and handle it accordingly in their code. The alpha channel of any opaque pixels should be set to
255
.bmp-ts/src/decoder.ts
Lines 438 to 452 in 2521cce
The documentation is also a bit unclear, endianess is pretty confusing when it comes to handling pixels, and since the library by default always decodes the image data to XBGR (because one might expect it's the same as input BMP), I think that the
toRGBA
option documentation should be clarified, "reverses the pixel byte order from ABGR to RGBA making it compatible with other libraries like pngjs"Additionally said option is completely ignored if you pass in a palettized image.
bmp-ts/src/decoder.ts
Lines 326 to 329 in 2521cce
The text was updated successfully, but these errors were encountered: