TwelveMonkeys
TwelveMonkeys copied to clipboard
BMP: Write support for more ARGB types
Hi Harald, Thank you for this great library. It helped me a lot. Could you please add support of ARGB type for BMP file format?
I found your question on StackOverFlow and as I understand standard ImageIO doesn't support ARGB: https://stackoverflow.com/questions/45487168/writing-a-bmp-with-transparency-using-imageio
Is there already any way to write BMP file with ARGB type using TwelveMonkeys? I tried BMPImageWriter but I got "Only TYPE_4BYTE_ABGR supported"
Thanks,
Is there already any way to write BMP file with ARGB type using TwelveMonkeys? I tried BMPImageWriter but I got "Only TYPE_4BYTE_ABGR supported"
As the exception message says, we only support TYPE_4BYTE_ABGR
, not TYPE_INT_ARGB
or similar types at the moment. You should be able to easily convert between these two types though, as they are basically just different byte layouts of the exact same data. So, no, but yes, you can. 😀
To convert, you can do:
BufferedImage type4ByteABGR = ImageUtil.toBuffered(original, TYPE_4BYTE_ABGR);
I have some work in progress to add support for any ARGB/RGBA/BGRA/ABGR types, but I don't have time/funding to finish it at the moment. Consider helping out, or sponsor the library to make it happen! 😀