Is there a problem - except with the filesize - when using bmp files for websites?
Should bmp files be used for websites
With browsers post-2002 or with Internet Explorer, there is no problem, they will display it. IE supported it and the others (you can find the code for Mozilla/Firefox and for Chrome/WebKit) followed suit to stay compatible. The only issue is indeed size, which means:
- a lot of unnecessary traffic from your web host,
- much longer download times for users.
If you need lossless compression, use PNG: it's widely supported, and the few browsers that do not support it completely, like IE 6, do support all the features BMP has too -- they just don't support PNG transparency but BMP doesn't have transparency either.
They do seem to be supported everywhere, I just tested WinXP/Firefox, WinXP/IE8, WinXP/Chrome, Win7/Firefox, Win7/Safari, Win7/IE9, OSX/Firefox, OSX/Chrome, OSX/Safari, OSX/Opera with a DIB-style BMP file. Don't try this with really old programs, but Photoshop 7+ will save DIB-style BMPs. en.wikipedia.org/wiki/BMP_file_format –
Seeger
You might want to use bmp since it has such low header overhead for tiny hard to compress images. I just tested a 5x5 image of pretty random colors: bmp@16bit=116bytes, gif=152bytes, png@24bit=1004bytes, png@paletted=1105bytes, jpeg@medium=1217bytes –
Seeger
Thanks for the test! It's not a huge improvement over GIF (or you have a very small web page content apart from tiny-hard-to-compress images!), but you're right. @8bit or monochrome it might be even less. But given the improvement (a few characters worth), I think I would use an image (in GIF probably) with all these small images and use CSS with padding to do the trick: that will save an HTTP connection too and apart if you have very very slow connections (< around 9600 bits/s) with low latency and a very specific use case it will be faster too. –
Hampden
I've actually gone into this a LOT more in-depth since last posting. DIB-BMPs have some interesting limitations, but the one that plays into file-size on small images is that a scanline(horizontal row of pixels) will be padded to a multiple of 32bits if it's not 32bits. A 5x5 image is terrible to test with because of this(it never works out the 32bits at any color depth). With a 4x4 16bit BMP you only have 88bytes(16bits * 4 pixels = 64bit scanline). –
Seeger
Lack of support? I wouldn't trust many browsers to handle them properly.
© 2022 - 2024 — McMap. All rights reserved.