Click to See Complete Forum and Search --> : Bitmap Compression
Brenton S.
May 16th, 2006, 07:49 AM
Hi all,
I have a really large .bmp file (1024x768) that I want to programmatically send to someone via AIM. Now I already know how to send it using AIM, but what I want to know is if there is a way I could compress the image so that it will send faster.
golanshahar
May 16th, 2006, 08:41 AM
What about compressing it to zip file?
Cheers
JamesSchumacher
May 16th, 2006, 12:08 PM
One thing you could do (but it would require reconstructing upon reception of the file) would be (and you could only do this is the bitmap was 24 bits and NOT 32 bit true color, due to the alpha being used >.>) would be to write out the file without the alpha values therefore reducing the size of the bitmap data by 25%.
1024 * 768 * 4 = 3145728 bytes of data.
1024 * 768 * 3 = 2359296 bytes of data.
This way you would save 786432 bytes, or exactly 768 KB. :)
Brenton S.
May 16th, 2006, 08:06 PM
Thanks all.
Lee Cheon-Sin
May 16th, 2006, 09:13 PM
Bitmaps usually don't contain 32-bits per pixel, unless a specialized program were used.
I believe Windows has some support for run-length encoded bitmaps (RLE), although they're fairly rare, and almost all bitmaps found are simply uncompressed bitmaps (BMP). If not, you could convert it to portable network graphics format (PNG) and send that instead. PNG is a good option, because it was designed to compress images. Such functionality is also built into Windows (I believe, but I could be guessing since Paint is able to save PNG files).
JamesSchumacher
May 17th, 2006, 11:06 AM
Bitmaps usually don't contain 32-bits per pixel, unless a specialized program were used.
That is true, however, even if they are only 24 bit bitmaps, the pixels are still stored in 32 bits due to the word alignment requirement.
So the method I mentioned will work.
mmscg
May 19th, 2006, 10:40 AM
24-bit bitmaps have pixel color data stored in 24 bits.
Scan lines must end on 32-bit boundaries.
JamesSchumacher
May 19th, 2006, 04:58 PM
24-bit bitmaps have pixel color data stored in 24 bits.
Scan lines must end on 32-bit boundaries.
Both true statements.... HOWEVER.....
Bitmaps 24 bits of valid pixel color data are stored aligned on 32 bit boundaries in order to make the scanline end on a 32 bit boundary.
That's why the COLORREF type is a typedef unsigned 32 bit integer. :p
philkr
May 20th, 2006, 05:38 AM
This discussion has no purpose since even if James is right, the PNG format proposed by Lee will still provide much more compression (and also lossless).
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.