File Format and Compression Tests

Member
Posts: 201
Joined: 2002.06
Post: #1
I have been doing some research on compression and various file formats. There have been a few discussions over what the best file formats and compression algorithms to use are. I figured I would try to help squash any questions there may be over file sizes.

Here is what I've come up with so far. I took some sample data and saved it into several different file types. I did this for images (with a fairly high resolution photo), text (.txt only with a few compression formats), and Cocoa .app bundles (I used Internet Explorer... maybe i should have tried a game instead). Also to come is music file formats, 3D file formats, and anything else I may think of. Please note that this is only a measurement of file sizes. The quality and features of the formats are not taken into consideration. There are lots of incomplete portions of the following (I didn't do any sorts of pictures that would be appropriate to use a .gif, for example). I also did some strange file extensions for the sake of differentiating them from others (they are not supposed to be real series of extensions in some cases, particularly the ones with the .app in them). If you don't understand what something means, ask me. Feel free to contribute your own research to this.

Code:
.eps = 10.3MB
.bmp = 7.6MB
.tif = 7.6MB
.pct = 7.4MB
.png = 3.9MB
max.jp2 = 3.2MB  --  max means maximum quality in jpg and jp2
max.jpg = 1.7MB
.gif = 1012KB
50.jp2 = 788KB  --  50 means 50% quality in jp2 and jp2
50.jpg = 344KB
-----------------------------------------------------------------------
.eps.gz = 6.7MB
.tif.gz = 5.4MB
.bmp.gz = 5.4MB
.pct.gz = 5.3MB
.png.gz = 3.8MB
max.jp2.gz = 3.2MB
max.jpg.gz = 1.6MB
gif.gz = 948KB
50.jp2.gz = 788KB
50.jpg.gz = 268KB
-----------------------------------------------------------------------
.eps.zip = 6.3MB
.tif.zip = 5.2MB
.bmp.zip = 5.2MB
.pct.zip = 5.1MB
.png.zip = 3.8MB
max.jp2.zip = 3.2MB
max.jpg.zip = 1.6MB
.gif.zip = 948KB
50.jp2.zip = 788KB
50.jpg.zip = 272KB
-----------------------------------------------------------------------
.eps.sit = 5.4MB
.pct.sit = 4.4MB
.tif.sit = 4.4MB
.bmp.sit = 4.4MB
.png.sit = 3.8MB
max.jp2.sit = 3.2MB
max.jpg.sit = 1.7MB
.gif.sit = 976KB
50.jp2.sit = 796KB
50.jpg.sit = 316KB
-----------------------------------------------------------------------
.eps.bz2 = 5.3MB
.tif.bz2 = 4.4MB
.bmp.bz2 = 4.4MB
.pct.bz2 = 4.3MB
.png.bz2 = 3.8MB
max.jp2.bz2 = 3.2MB
max.jpg.bz2 = 1.6MB
.gif.bz2 = 952KB
50.jp2.bz2 = 972KB
50.jpg.bz2 = 272KB
-----------------------------------------------------------------------
.eps.sitx = 5.1MB
.tif.sitx = 4.3MB
.pct.sitx = 4.3MB
.bmp.sitx = 4.3MB
.png.sitx = 3.9MB
max.jp2.sitx = 3.2MB
max.jpg.sitx = 1.6MB
.gif.sitx = 976KB
50.jp2.sitx = 792KB
50.jpg.sitx = 300KB
-----------------------------------------------------------------------
.txt = 524KB
.txt.gz = 188KB
.txt.zip = 176KB
.txt.bz2 = 152KB
.txt.sit = 152KB
.txt.sitx = 140KB
-----------------------------------------------------------------------
.app = 19.8MB
.app.cdr.dmg = 24.3MB
ro.app.dmg = 21MB  --  ro means read-only format for dmg
.app.tar = 18.9MB
comp.app.dmg = 7.2M  --  comp means compressed format for dmg
-----------------------------------------------------------------------
comp.app.dmg.sit = 7.3MB
comp.app.dmg.bz2 = 7.2MB
comp.app.dmg.sitx = 7.2MB
comp.app.dmg.zip = 7.2MB
comp.app.dmg.gz = 7.2MB
-----------------------------------------------------------------------
.app.tar.gz = 6.5MB
.app.tar.zip = 6.3MB
.app.tar.sitx = 5.7MB
.app.tar.sit = 5.5MB
.app.tar.bz2 = 5.5MB
-----------------------------------------------------------------------
ro.app.dmg.gz = 6.5MB
ro.app.dmg.zip = 6.3MB
ro.app.dmg.sit = 5.5MB
ro.app.dmg.bz2 = 5.5MB
ro.app.dmg.sitx = 4.8MB
-----------------------------------------------------------------------
.app.cdr.dmg.gz = 6.5MB
.app.cdr.dmg.zip = 6.3MB
.app.cdr.dmg.sit = 5.5MB
.app.cdr.dmg.bz2 = 5.5MB
.app.cdr.dmg.sitx = 4.8
-----------------------------------------------------------------------
.eps = 10.3MB
.bmp = 7.6MB
.tif = 7.6MB
.pct = 7.4MB
.eps.gz = 6.7MB
.eps.zip = 6.3MB
.tif.gz = 5.4MB
.eps.sit = 5.4MB
.bmp.gz = 5.4MB
.pct.gz = 5.3MB
.eps.bz2 = 5.3MB
.tif.zip = 5.2MB
.bmp.zip = 5.2MB
.pct.zip = 5.1MB
.eps.sitx = 5.1MB
.tif.bz2 = 4.4MB
.pct.sit = 4.4MB
.tif.sit = 4.4MB
.bmp.bz2 = 4.4MB
.bmp.sit = 4.4MB
.pct.bz2 = 4.3MB
.tif.sitx = 4.3MB
.pct.sitx = 4.3MB
.bmp.sitx = 4.3MB
.png = 3.9MB
.png.sitx = 3.9MB
.png.sit = 3.8MB
.png.bz2 = 3.8MB
.png.zip = 3.8MB
.png.gz = 3.8MB
max.jp2.sit = 3.2MB
max.jp2.sitx = 3.2MB
max.jp2.bz2 = 3.2MB
max.jp2 = 3.2MB
max.jp2.gz = 3.2MB
max.jp2.zip = 3.2MB
max.jpg = 1.7MB
max.jpg.sit = 1.7MB
max.jpg.gz = 1.6MB
max.jpg.zip = 1.6MB
max.jpg.sitx = 1.6MB
max.jpg.bz2 = 1.6MB
.gif = 1012KB
.gif.sit = 976KB
.gif.bz2 = 952KB
.gif.gz = 948KB
.gif.zip = 948KB
50.jp2.sit = 796KB
50.jp2.bz2 = 792KB
50.jp2.sitx = 788KB
50.jp2 = 788KB
50.jp2.gz = 788KB
50.jp2.zip = 788KB
50.jpg.sit = 316KB
50.jpg.sitx = 300KB
50.jpg.bz2 = 272KB
50.jpg.zip = 272KB
50.jpg.gz = 268KB
-----------------------------------------------------------------------
.app.cdr.dmg = 24.3MB
ro.app.dmg = 21MB
.app.tar = 18.9MB
comp.app.dmg.sit = 7.3MB
comp.app.dmg.bz2 = 7.2MB
comp.app.dmg.zip = 7.2MB
comp.app.dmg.gz = 7.2MB
.app.cdr.dmg.gz = 6.5MB
ro.app.dmg.gz = 6.5MB
.app.tar.gz = 6.5MB
.app.cdr.dmg.sit = 5.5MB
ro.app.dmg.zip = 6.3MB
.app.tar.zip = 6.3MB
.app.tar.sitx = 5.7MB
.app.tar.sit = 5.5MB
.app.cdr.dmg.sit = 5.5MB
ro.app.dmg.sit = 5.5MB
ro.app.dmg.bz2 = 5.5MB
.app.cdr.dmg.bz2 = 5.5MB
.app.tar.bz2 = 5.5MB
.app.cdr.dmg.sitx = 4.8MB
ro.app.dmg.sitx = 4.8MB
Quote this message in a reply
Moderator
Posts: 680
Joined: 2002.11
Post: #2
Problem is, JPEG at 50% quality will mess with your colors a bit and if you're using one transparency color that's a really bad thing.

My web site - Games, music, Python stuff
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #3
I'm very surprised that attempting to apply additional compression to a JPEG or GIF should make any difference at all. Does your test image have a resource fork with thumbnails attached or something?

Speaking of which, I always remove the resource forks from image and text resource files before I release them to help decrease the archive size.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #4
Wow... Nice tests Smile
Quote this message in a reply
Member
Posts: 201
Joined: 2002.06
Post: #5
Quote:Originally posted by NCarter
I'm very surprised that attempting to apply additional compression to a JPEG or GIF should make any difference at all. Does your test image have a resource fork with thumbnails attached or something?

Speaking of which, I always remove the resource forks from image and text resource files before I release them to help decrease the archive size.


I forgot about that. *checks* All the images have thumbnails except for the jpeg2000s. I may go back and strip the thumbnails and try again.
Quote this message in a reply
Member
Posts: 114
Joined: 2002.08
Post: #6
One must also remember that gif reduces the color range to go smaller, and that png is good for flatter color images without quality loss(i.e. cartoons).

"Most nutritionists say that Twinkies are bad. But they're not, they're very very good."
Quote this message in a reply
Member
Posts: 201
Joined: 2002.06
Post: #7
As I said, I didn't take the quality and best uses of the file formats into any sort of consideration. I only did strict file size comparisons. I had orginally planned to put notes about what each format is good for and not good for. I might do that still.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #8
Are you planning to add this to the FAQ? If you are, it's definitely worth adding those extra notes.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 201
Joined: 2002.06
Post: #9
I had thought about adding this. If I do I will probably take most of those numbers out and just make a guide about choosing what formats to use with a few numbers to support it.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #10
Really valuable tests.

If you do make a faq or article on this, I'd actually like you to keep all the numbers in. Smile

Also, it's extremely important to strip out any resources attached to ALL the files to get a good comparison.

I'd be very interested in an update to this.

Please go for it!

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Member
Posts: 201
Joined: 2002.06
Post: #11
I've just been re-inspired to do this again with more accurate and extensive tests, and then I'll type an official report of my research to put in the FAQ. Today is a bad day for it though. I will try for it... Thursday.
Quote this message in a reply
Griggs
Unregistered
 
Post: #12
Hmm, very interesting. It seems that .sit and .bz2 are fairly evenly matched.

I look forward to your complete report. Someone will need to fire up their math and graphing apps to find averages, deviations and make up some benchmark style graphs. Smile

I would also appreciate it if you would include an average ProjectBuilder project in your tests, with some source, nib files, images, etc. Here at iDG source code makes up much of our downloads, knowing what formats are better could be quite helpful.
Quote this message in a reply
Member
Posts: 201
Joined: 2002.06
Post: #13
Okay, I will include projects as well.

Are XCode projects in any way fundamentally different from Project Builder projects?

I will do my best to make some handy charts, graphs, and statistics. I don't have any awesome software capable of that. Any freeware suggestions?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #14
Quote:Originally posted by geezusfreeek
Are XCode projects in any way fundamentally different from Project Builder projects?


Nope.
Quote this message in a reply
ahruman
Unregistered
 
Post: #15
I'm sorry, but taking a hi-res photo and putting it in an EPS file and a JFIF file does not constitute a meaningful "stric file size comparison", unless you only plan to distribute that particular photo.

For that matter, sizes will vary dramatically based on encoding application and settings, especially for TIFF, PNG and all lossless formats.

Also, if you're planning to recompress an image in PNG or GIF format, you'll get much better results if you disable their built-in lossless compression (for instance, recompressing PNG IDAT chunks with zlib compression level 0).
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  What are the most popular graphic file format for games? WhatMeWorry 14 7,025 Nov 22, 2004 03:53 PM
Last Post: KenD
  Image compression: Jpeg medium quality Najdorf 15 8,704 Apr 13, 2003 10:43 AM
Last Post: skyhawk
  Asset Compression doucettecd 2 3,679 Aug 27, 2002 01:01 PM
Last Post: aarku