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
Transparency in the BMP image format #717
Comments
Yes, it's possible. Unfortunately software support for transparency in BMP is variable, but I think most "serious" software should support it. My I assume you want to write your own BMP writer, then the best option is probably to write one of the more recent DIB headers, that contains alpha masks ( There's a lot of good information in the Wikipedia article on BMP. Other options could be to write uncompressed TGA or TIFF format. The PAM format (an evolution of PBM/PGM/PPM that also supports alpha, using |
Found your SO question, which indicates that you want to write the BMP using the TwelveMonkeys library... We do support transparency in BMP, currently only using But then I'm afraid I don't understand the following:
Could you elaborate on this, perhaps even show code or pseudo-code? If you want to write a |
Thank you for your reply. You are right, of course, and my question is not clear. Currently I use the BigBufferedImage class from MiklosPathy which keeps only parts of the image in memory and swaps the remaining parts to a temporary file. Not perfect and also from the performance everything else than good but with pictures which have 36000x36000 dimensions not differently possible. My original plan was to create a big BufferedImage empty and save it to disk. After that I wanted to replace single parts of the image with ImageIO. For this I found this SO question. |
Hmmm... That Well, our But... If your huge image is already on disk... Why do you want to write an empty image to disk, and then manipulate using Another option could be to just create a "fixed" header in BMP (or TGA/TIFF/PAM or other uncompressed format) and memory map the entire image data section and create a |
Do I (as a user of the twelvemonkeys API) need to do anything special when reading the BMP in order to get the support of "fake" transparency? |
I have a bmp file (unfortunately github won't let me upload it), that has the following out put form imagemagick
but twelvemonkeys 3.9.4 doesn't seem to detect the transparency. |
After inspecting the image header, it looks like the size of the DIB is 40 ( BITMAPINFOHEADER), the bits per pixel is 32, and the compression method is 0 (BI_RGB). So it doesn't actually have any masks set, but I assume that the extra byte is meant as an alpha channel. This image displays with a transparent background in some programs such as imagemgaick |
Hmm.. I think I added to the confusion I wrote that about "fake" transparency support... Turns out we don't support this kind of fake "alpha" any more (we did at some point, but it turned out to be confusing). 😮 However, as I mentioned in #727, all the alpha data is there, if you want to "restore" it. With the normal PS: @tmccombs You can usually upload any kind of file if you zip compress it first, if you think that sample is important. |
Again to the initial question from me. Thanks for your help @haraldk and also for your ideas. I had to pause the project for some time due to work but I was able to solve the problem as you said. From my side the issue is ready to close. However, I don't want to interrupt the side conversation. |
Thanks @Skillkiller! I think we have the side conversation covered in a separate thread, so closing this. |
Hello,
is it possible to store a BufferedImage with transparency in the BMP image format? With 32 bits per pixel this information should be storable. I also don't need a fine gradation of transparency but only is transparent or not.
I need to save it in a directly modifiable format because the image is too large for the memory of the creating program and the program assembles the image piece by piece.
The text was updated successfully, but these errors were encountered: