How to convert bmp image to png with transparecy

I have transparenet bmp image img0674_00030000P000.rar (150 KB) I want convert this image to png with transparency

Here is this in png format conevrtered with XnView


and here convertered with Directory Opus


When I convert transparent bmp images to png transparenct is lost. Can you add support for transparency in conversion from bmp tp png ?

This image it only example. Normally to convert many images I use XnView but sometimes I want convert a few images and to a few images I dont want start XnView because convert them in Directory Opus will be faster.

There isn't a way that is built-in to Opus. It may be possible to create a button which does it using an external tool (e.g. ImageMagick, or even XnView if it can be controlled via the command line).

Opus (like almost everything) doesn't support alpha channels in BMP files as, to the best of my knowledge, they have never been part of the BMP format. You can have 32-bpp BMP files but the 4th channel is basically undefined, and likely to be garbage data in a lot of files, so it's risky to assume it is meaningful or has a particular meaning.

For example, the 4th channel could be used for normal maps if the BMP is being used as a 3D texture. In a lot of cases it will be all zeros and I'm guessing some BMP writers will leave it as random/uninitialised data.

Loading your test image into Photoshop gives the same result as loading it into Opus. Photoshop does not show any transparency, and the background is black. If I click on the Channels tab in Photoshop, I can see there is a channel with the transparency data in it, but it is an arbitrary extra channel and not interpreted as transparency data; it takes some manual steps in Photoshop to take that data and make it be used for transparency.

I think in general you can only assume the 4th channel in a BMP is transparency data if you know/control what created the file. So it can be used in specific workflows/pipelines (in fact, we do the same ourselves in a couple of places), but it isn't really part of the format or the general case. As far as I know there isn't a flag in the BMP format/header which says the 4th channel is valid transparency data. Heuristics could be used, but they are often not reliable.

Having said that, we have an option to assume the 4th channel in TGA files is transparency, so it's not out of the question. But I strongly suspect it would cause problems with BMP files as the BMP format and all the different software that produces BMP data is such a mess already.