This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to write 32 bit bmp?  RSS feed

 
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: 42972
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: 16007
87
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!