How to test if a bitmap file has a transparent background?

All we need is an easy explanation of the problem, so here it is.

I created a bitmap with transparent background but in the Windows Picture Viewer I see the white background and even if I reopen it in Photoshop CS3. how do I make sure the white colour in bitmap is really transparent or see if contain any transparent colour?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Bitmaps (i.e. files with .BMP extension) do not natively support transparency: you need to save as a different format like PNG. Another format that supports transparency is GIF but it is only suitable for simple images with few colours. The best format depends on the image and where it will be used.

If the background is transparent then in Photoshop and most other image editors you would normally see a checkered background made up of small white and grey squares. But the Windows Picture Viewer itself is no good for testing transparency – it shows transparent areas as being white.

Update

Since this answer was originally written (some 8 years ago) it has been pointed out that the BMP format can support transparency in some cases. Still I would not recommend using it for this purpose, many programs will not interpret the alpha channel correctly and there would be no real reason for using it over something like PNG.

Method 2

BMP’s do support transparency. Bitmap must be set to indexed 256 color, and pixel at (0,0) is for the color that you want transparent.

Method 3

If you have Office, start a new presentation using something other than the default blank template, then insert your picture (on the Insert tab in 2007/2010 or Insert | Picture | From File in earlier versions). If you can see through the (supposedly) transparent bits of your picture to the background behind it, then the image does have transparency. Otherwise, no.

This assumes that the image is in a format that PPT can insert (BMP, GIF, PNG, JPG etc).

Method 4

Convert image to PNG to support transparency.
If photoshop cs3 does not show checkered background its not transparent.
The output or saved format decide whether you will see transparency.

Method 5

Since v2.1.4 BPM supports transparency.
https://en.wikipedia.org/wiki/BMP_file_format#Pixel_storage

In version 2.1.4 FFmpeg supported (in its own terminology) the BMP
pixel formats bgra, bgr24, rgb565le, rgb555le, rgb444le, rgb8, bgr8,
rgb4_byte, bgr4_byte, gray, pal8, and monob; i.e., bgra was the only
supported pixel format with transparency.

And here is how to test/create BMP with transparency (via PSP):
https://www.axialis.com/tutorials/tutorial-misc002.html

However, you should consider twice before using BMP today. BMP is (mostly) uncompressed therefore it wastes a lot of storage place.

PNG is one of the best formats around (too bad it does not support animation, like GIF).

There is also a new graphic format (WebP from Google) on the horizon, initially crated for web images. I can barely wait to be supported by common applications (MS Paint, Windows, programming languages, etc).
https://medium.com/beginners-guide-to-mobile-web-development/web-image-formats-googles-webp-17e2fe5fc53e

WebP is a modern image format that provides superior lossless and
lossy compression for images on the web. Using WebP, webmasters and
web developers can create smaller, richer images that make the web
faster.

and

WebP lossless images are 26% smaller in size compared to PNGs. WebP
lossy images are 25–34% smaller than comparable JPEG images at
equivalent SSIM quality index.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply