PDA

View Full Version : Is QImage BMP lossless?



jajcek
7th November 2012, 19:28
Hi,

I hope this question is not inappropriate. I wonder if the BMP created by the QImage::save() method creates a lossless bitmap? I know that MS Paint somehow losses the quality when saved (it is even possible to see the lower quality at save time). How about the QImage class?

Thanks.

wysota
7th November 2012, 23:46
BMP doesn't have any internal compression (as far as I know) thus by design it is loseless. If Paint indeed causes some loss in quality, it is because of Paint, not BMP.

ChrisW67
8th November 2012, 06:39
There are various forms of BMP, some with lossless run-length encoding, none with lossy image compression like JPEG. Taking a 24-bit image and putting it in a 24-bit BMP will not be lossy. Any alpha channel from a 32-bit image may be lost because only recent variants of BMP support it. Also if Qt (or Paint) produces a 16-bit or colour mapped BMP then it will be lossy with respect to the original image. It seems the Qt output code will do the right default thing from a cursory inspection of the source (src/gui/image/qbmphandler.cpp).