• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to write 32 bit bmp?

 
lajos kamocsay
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm trying to write a 32 bit BMP file (TYPE_ARGB). Even though my BufferedImage is the correct type, the file written by ImageIO is always 24 bit.

Sample code below.

Any ideas?

Thanks!

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think BMP supports more than 24 bits per pixel, or transparency in general.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15715
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Windows BMP format does support 32 bits per pixel according to this MSDN page, but it's not very useful; in the 32 bits that are stored for a pixel, only 24 are used for the pixel data and 8 bits are unused.

BMP does not support transparency (i.e. an alpha channel).

You could use the PNG format instead, which is supported by the Java ImageIO API and which does support transparency.
[ May 07, 2007: Message edited by: Jesper Young ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!