
Another Compression Format (ACF)
Description
Design, developed and implemented my own form of image compression. The
implementation is kind of messy since it was made more to prove a concept than
to actually be used to compress images and so it is a bit slow. The compression
is lossless and works by trying to find 2 dimensional blocks of the same color.
It also looks for vertical lines and then vertical patterns of 2 or 4 colors.
After all the two-dimensional primitives are "removed", the image is
restructured into a single continuous line of pixels. Here horizontal lines and
patterns are taken out and finally a smooth shading compression is applied. This
stores the first pixel and then stores the difference between that pixel and the
next. Then the next pixel's color is stored from the difference between that
pixel and the previous. The compression looks rows of pixels whose continuous
differences can be stored with 2 to 6 bits per color. All pixels that were not
used are then tagged onto the end.
With both two-dimensional compression and smooth shading compression, both paletted images (like screen shots or cartoons) and real pictures can be compressed. Compared to standards like PNG, the compression usually comes close to, but does not beat the file size. However, on smooth gray scale images, where the difference between pixels can be stored with only 2-6 bits per pixel (not color), then file size is reduced significantly and can beat the file size that PNG produces.
Also, since this compression does not utilize a hash-map or any kind of LZW compression, the files produced by ACF can be further compressed using ZIP or RAR.
In Action

Comparison
|
Picture |
Type |
BMP |
PNG |
RAR |
ACF |
ACF+RAR |
8-bit BMP + RAR
|
|
Buildings |
Color Photograph |
156,470 |
144,416 |
121,003 |
122,542* (21%) |
115,333 |
- |
|
Cylinders |
Gray shaded Ray-traced |
2,359,350 |
1,160,357 |
758,569 |
692,912* (70%) |
608,303 |
596,387 |
|
Flake |
Gray shaded Ray-traced |
2,359,350 |
839,415 |
699,483 |
596,223* (74%) |
558,545 |
576,500 |
|
GlassTree |
Color Ray-traced |
2,359,350 |
1,217,666 |
1,074,999 |
1,424,566 (39%) |
1,217,173 |
- |
|
MMX3 |
Color Photograph |
2,589,354 |
1,237,685 |
1,292,594 |
1,495,773 (42%) |
1,299,560 |
- |
|
Myst 3 |
Color Detailed |
2,359,354 |
1,331,641 |
1,625,019 |
1,674,361 (29%) |
1,488,380 |
- |
|
Peppers |
Color Photograph |
709,614 |
388,078 |
593,036 |
475,897 (32%) |
443,441 |
- |
|
Peppers B&W |
Gray shaded Photograph |
709,614 |
217,263 |
212,912 |
164,717* (76%) |
154,354 |
181,004 |
|
Screen1 |
8-bit Color Screenshot |
2,359,350 |
36,734 |
24,647 |
59,850 (97%) |
34,089 |
17,787 |
|
Screen2 |
8-bit Color Screenshot |
2,359,350 |
55,603 |
35,573 |
82,856 (96%) |
49,368 |
24,467 |
*ACF beats PNG
Download
ACF File Format
ACF Source and Executable
Copyright Chris Becker 2001-2003 All Rights Reserved.