shaozilee / bmp-js

A pure javascript BMP encoder and decoder for node.js
MIT License
87 stars 46 forks source link

Encoding: option for 24bpp input support (fixes #9) #10

Closed tkalliom closed 7 years ago

tkalliom commented 7 years ago

There are several kinds of possible input formats for the encoding. However, non-8bpc colors would require an overhaul to the BMP header writing.

I briefly considered an implementation that would automatically derive from the input buffer size and image dimensions the presence of the fourth byte; and throw an error if the dimensions and size are incompatible. While the added safety would probably have been a good thing for many users, I guess there might be some funkier uses of buffers which would break. Plus, the parameter at least makes it clear what is supported.

So, here is the ”put new functionality behind a flag” approach to avoid changing anything for past users.

coyotte508 commented 7 years ago

Please update the package on npm with the fix!