Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMP: Write support for more ARGB types #858

Open
bepopov opened this issue Nov 3, 2023 · 1 comment
Open

BMP: Write support for more ARGB types #858

bepopov opened this issue Nov 3, 2023 · 1 comment

Comments

@bepopov
Copy link

bepopov commented Nov 3, 2023

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"

@haraldk
Copy link
Owner

haraldk commented Nov 3, 2023

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! 😀

@haraldk haraldk changed the title Support of BMP ARGB writing BMP: Write support for more ARGB types Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants