I havent decided on a technology yet but i wanted to ask. BMP images are large, i compressed a 3mb image to 50k. Browsers can decode gzip text, so would it be possible to gzip bmp on my server and have the user request mysite.com/images/test.bmp and have it decompress my gzip bmp on the other side so the user doesnt notice a difference?
feedback
|
|
If possible, use PNG as image format. It's the defacto standard for lossless image compression and will probably surpass the compression level achieved by merely gziping bitmaps. If you need to use BMP because of dependencies from legacy systems, you can try using the output compression methods available in your webserver, e.g. see mod_deflate for Apache. Wireshark can be especially helpful in testing/debugging such setups. | |||
|
feedback
|
|
Gzip before sending. Good webservers (Apache, NGINX, and probably lighttpd) all support having a 'image.bmp.gz' on disk, and sending that instead of 'image.bmp' if the browser supports it. Add this to .htaccess in apache: "AddEncoding x-gzip .gz". I fraggin' hate it when people think compressing files on the fly really saves anything. Really, you should just use PNGs, since they are gzipped BMPs, sometimes with an alpha channel thrown in as well. The format was created to make people stop using GIFs, who's compression algorithm was, and might still be under patent by Unisys. Oh, and a bmp.gz and png will compress equally well. | |||
feedback
|
|
With using apache and mod_gzip or mod_deflate, if the client accepts gzipped content, apache will serve gzipped file. Even you can add a file.gz in pair with the original file helping out apache with gzipping. If you do not want to host original files, normally apache will answer with 404 for a .bmp request. (You do not have that file do you?). But with the help of apache mod_rewrite you can add some rewrite rules to serve gzipped bmp instead of returning a 404 Error. Sample (and untested) rewrite rules:
| |||
|
feedback
|
|
I am not sure if my test is representative: I compressed a local | |||||||
feedback
|
|
From mod_gzip's sourceforge.net page: "mod_gzip is an Internet Content Acceleration module for the popular Apache Web Server. It compresses the contents delivered to the client. There is no need to install any additional software on the client!" I think it basically compresses everything it sends with the exception of anything which is already compressed, such as JPGs or GIFs, etc. I think it is often enabled in default Apache installations, but you can Google for docs. | |||
|
feedback
|
|
Hmm, interestingly ziproxy http://ziproxy.sourceforge.net/ seems to gzip "text likes" and convert images to jpeg. I can see possible issues zipping bmps - might not compress well, or fast, for example. Certainly conversion to a.n.other format is more browser-compatible. As suggested, PNG will support everything you need, jpeg might do if you can hack lossy compression in your application. Don't quote me on this but i am fairly sure you could automate this and convert on-the-fly. I would be inclined to run a (nightly?) job that converts bmps (use "convert" if you're on unix) and rewrites links. Give us a bit more "why" and we may get a better "how" :) Where are your bmps coming from, how are they being serverd, what platform, etc.? | |||
|
feedback
|