RSS/Atom feed Twitter
Site is read-only, email is disabled

32bit BMP appear blank

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

32bit BMP appear blank Aurimas Juška 03 Jan 16:10
  32bit BMP appear blank Raphaël Quinet 03 Jan 20:42
   32bit BMP appear blank Sven Neumann 05 Jan 11:47
    32bit BMP appear blank Sven Neumann 05 Jan 22:33
Aurimas Juška
2007-01-03 16:10:54 UTC (almost 18 years ago)

32bit BMP appear blank

Hi,

This is a summary of Bug 352262 – 32bit bitmaps (*.bmp) appear blank ( http://bugzilla.gnome.org/show_bug.cgi?id=352262 ) which as Sven said is important to be settled before releasing 2.4 version.

After bmp plug-in has been updated it, among other things, started parsing bytes which were thought to be alpha channel. When bitmap contained valid alpha data in these bytes (which can be created with PS or some other app), this feature worked as expected. However, when bitmap was saved in 32 bit format without alpha, all those bytes became 0. As the result, image appeared completely blank on the screen.

The main question: should those bytes be ignored (as it is done by many applications) or should some workaround be used (in case we want to support 32bit bitmaps with alpha channel)?

Unfortunately, we were unable to find any official documentation dealing with the problem.

Programming Windows, 5th Edition (Charles Petzold - MS Press, 1998) tells that those bytes should be 0. In other words, they should be ignored while loading and set to 0 while saving.

P.S. Results of the discussion could be useful when solving Bug 65534.

Raphaël Quinet
2007-01-03 20:42:58 UTC (almost 18 years ago)

32bit BMP appear blank

On Wed, 3 Jan 2007 17:10:54 +0200, "Aurimas Ju?ka" wrote:

This is a summary of Bug 352262 ? 32bit bitmaps (*.bmp) appear blank ( http://bugzilla.gnome.org/show_bug.cgi?id=352262 ) which as Sven said is important to be settled before releasing 2.4 version.

[...]

The main question: should those bytes be ignored (as it is done by many applications) or should some workaround be used (in case we want to support 32bit bitmaps with alpha channel)?

I did a quick web search to see how some applications dealt with this problem and I found a number of links to photoshop plug-ins (including one GPL program [1]) and standalone programs for converting or editing Windows .BMP or .ICO files. It should be noted that the support for the alpha channel is an extension added in Windows XP (and made partially obsolete by the usage of PNG in Windows Vista) so it is unlikely to be available or even mentioned in programs, books or official or unofficial specifications written before 2001.

As mentioned on many web sites, there does not seem to be any complete and official specification of the BMP file format available anywhere. Even the documentation from Microsoft (MSDN Library) does not mention the usage of the alpha channel although it is used in Windows XP.

I have not tried these programs supporting alpha channels in BMP but from their descriptions I could identify the following strategies when loading 32-bit BMP or ICO files:
1) Always ask the user if the alpha channel should be used or not 2) Use the alpha channel if and only if it contains at least one non-zero value.
3) Use the alpha channel if the file name ends in .ICO, ignore it if it is .BMP.

The second strategy seems like a good compromise and would probably work in most cases (i.e., match the user's expectations).

-Raphaël

[1] http://www.telegraphics.com.au/svn/icoformat/trunk/dist/README.html

Sven Neumann
2007-01-05 11:47:43 UTC (almost 18 years ago)

32bit BMP appear blank

Hi,

On Wed, 2007-01-03 at 20:42 +0100, Raphaël Quinet wrote:

I have not tried these programs supporting alpha channels in BMP but from their descriptions I could identify the following strategies when loading 32-bit BMP or ICO files:
1) Always ask the user if the alpha channel should be used or not 2) Use the alpha channel if and only if it contains at least one non-zero value.
3) Use the alpha channel if the file name ends in .ICO, ignore it if it is .BMP.

The second strategy seems like a good compromise and would probably work in most cases (i.e., match the user's expectations).

I agree. Let's go for this option then.

Sven

Sven Neumann
2007-01-05 22:33:04 UTC (almost 18 years ago)

32bit BMP appear blank

Hi,

Aurimas wrote a patch that implements it the way that Raphael suggested. Thanks a lot for that, the patch has been committed in the meantime.

While reviewing this patch it became evident that the BMP plug-in is one of those evil fellows among the file plug-ins. It allocates a buffer the full size of the image instead of transferring the pixel data to/from the core tile-by-tile or at least in smaller stripes. It does this both for loading and saving. If possible, this should be changed.

Sven