source: subversion/applications/utils/color255/README.TXT @ 29411

Last change on this file since 29411 was 3007, checked in by jonb, 12 years ago

color255: A faster way to convert tiles to an 8 bit indexed palette

File size: 1.6 KB
Line 
1color255
2========
3
4This is a trivial C program which intends to be a lightweight replacement
5for the ImageMagick convert tool. Even though it uses the same ImageMagick
6library this program is much faster to convert 32bit RGBA PNGs to an 8bit
7colour palette PNG. This is useful for tile renderers which prefer the
8smaller tile size and quick conversion.
9
10Requirements
11------------
12This needs the ImageMagick C library and development headers to be installed
13
14Fedora: yum install ImageMagick-devel
15Ubuntu/Debian: apg-get install libmagick9-dev
16
17Tests
18-----
19
20A sample set of 700 tiles of 256x256 32bit RGBA PNG from tilecache was
21selected. These were then converted individually and timed,
22
23$time find tilecache -type f -name '*.png' -exec convert -colors 255 {} {} \;
24
25real    2m37.116s
26user    1m1.218s
27sys     1m33.867s
28
29Repeat again with the original tiles:
30
31real    2m40.155s
32user    1m3.852s
33sys     1m34.423s
34
35Note the enormous amount of system time. This seems to be the real killer
36for convert. It isn't clear what it is trying to do which causes this hit.
37
38Now running this tool against the same files:
39
40$ find tilecache -type f -name '*.png' -exec ./color255 {} \;
41
42real    1m3.758s
43user    0m56.641s
44sys     0m6.435s
45
46Repeat again with the original tiles:
47
48real    1m4.654s
49user    0m57.302s
50sys     0m6.485s
51
52This version is more than twice as fast (with the drop in system usage
53being the biggest change).
54
55It can be made even faster if it can operate on multiple files at once
56by amortizing the startup costs:
57
58$ time find tilecache -type f -name '*.png' | xargs ~/bin/color255
59
60real    0m54.372s
61user    0m52.441s
62sys     0m1.741s
63
Note: See TracBrowser for help on using the repository browser.