README
author Tero Marttila <terom@paivola.fi>
Sun, 14 Sep 2014 16:08:40 +0300
changeset 132 0260aeca943c
parent 123 81d1cad8b588
child 156 01a05c807e82
permissions -rw-r--r--
cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
     1
# libpngtile
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
Constant-time/memory tile-based handling of large PNG images.
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
     5
## About
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
     6
    pngtile is a C library (and associated command-line utility) offering efficient random access to partial regions of
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
    very large PNG images (gigapixel range).
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
    For this purpose, the library linearly decodes the PNG image to an uncompressed memory-mapped file, which can then
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
    be later used to encode a portion of this raw pixel data back into a PNG image.
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    12
## Notes
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
    The command-line utility is mainly intended for maintining the image caches and testing, primary usage is expected
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
    to be performed using the library interface directly. A simple Cython wrapper for a Python extension module is
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
    provided under python/.
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
    There is a separate project that provides a web-based tile viewer using Javascript (implemented in Python as a
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
    WSGI application).
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
73
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    20
    The .cache files are not portable across different architectures, nor are they compatible across different cache
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    21
    format versions.
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    22
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    23
    The library supports sparse cache files. A pixel-format byte pattern can be provided with --background using
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    24
    hexadecimal notation (--background 0xFFFFFF - for 24bpp RGB white), and consecutive regions of that color will
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    25
    be omitted in the cache file, which may provide significant gains in space efficiency.
29
88691556661f include include in dist, more README
Tero Marttila <terom@fixme.fi>
parents: 28
diff changeset
    26
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    27
## Build
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
    The library depends on libpng and pthreads. The code was developed and tested using:
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    29
        
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    30
        * libpng12-dev      png.h       1.2.15~beta5-3ubuntu0.1
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    31
        * libc6-dev         pthread.h   NPTL 2.7 (glibc 2.7-10ubuntu5)
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    32
123
81d1cad8b588 docfix README for new Makefile
Tero Marttila <terom@fixme.fi>
parents: 74
diff changeset
    33
    To compile dist versions, simply execute
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    34
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    35
        $ make
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    36
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    37
    To compile source versions, execute:
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    38
        
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    39
        $ make dirs
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    40
        $ make
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    41
123
81d1cad8b588 docfix README for new Makefile
Tero Marttila <terom@fixme.fi>
parents: 74
diff changeset
    42
    The libpngtile.so and pypngtile.so libraries will be placed under lib/, and the 'pngtile' binary under bin/.
81d1cad8b588 docfix README for new Makefile
Tero Marttila <terom@fixme.fi>
parents: 74
diff changeset
    43
81d1cad8b588 docfix README for new Makefile
Tero Marttila <terom@fixme.fi>
parents: 74
diff changeset
    44
    XXX: If compiling the pypngtile.so library with make fails, then `setup.py build_ext -i` should build it.
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    45
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    46
## Usage
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
    Store the .png data files in a directory. You must have write access to the directory when updating the caches,
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    48
    which are written as a .cache file alongside the .png file.
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    49
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    50
    Provide any number of *.png paths as arguments to the ./bin/util command. Each will be opened, and automatically
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    51
    updated if the cache doesn't exist yet, or is stale:
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    52
74
7c8226668e87 rename util -> pngtile
Tero Marttila <terom@fixme.fi>
parents: 73
diff changeset
    53
        pngtile -v data/*.png
73
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    54
    
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    55
    Use -v/--verbose for more detailed output.
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    56
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    57
74
7c8226668e87 rename util -> pngtile
Tero Marttila <terom@fixme.fi>
parents: 73
diff changeset
    58
    To render a tile from some image, provide appropriate -W/-H and -x/-y options to pngtile:
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    59
        
74
7c8226668e87 rename util -> pngtile
Tero Marttila <terom@fixme.fi>
parents: 73
diff changeset
    60
        pngtile data/*.png -W 1024 -H 1024 -x 8000 -y 4000
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    61
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    62
    The output PNG tiles will be written to temporary files, the names of which are shown in the [INFO] output.
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    63
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    64
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    65
    To force-update an image's cache, use the -U/--force-update option:
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    66
74
7c8226668e87 rename util -> pngtile
Tero Marttila <terom@fixme.fi>
parents: 73
diff changeset
    67
        pngtile --force-update data/*.png
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    68
73
5dfb245b814d docfix: README and --background
Tero Marttila <terom@fixme.fi>
parents: 29
diff changeset
    69
    Alternatively, to not update an image's cache, use the -N/--no-update option.
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    70
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    71
## Issues
28
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    72
    At this stage, the library is primarily designed to handle a specific set of PNG images, and hence does not support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    73
    all aspects of the PNG format, nor any other image formats.
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    74
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    75
    The pt_images opened by main() are not cleaned up before process exit, due to the asynchronous nature of the tile
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    76
    render operation's accesses to the underlying pt_cache object.
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    77
132
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    78
# pypngtile
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    79
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    80
Python extension for pngtile
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    81
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    82
## Dependencies
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    83
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    84
    * python-cython
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    85
    * python-dev
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    86
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    87
## Build
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    88
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    89
    $ python setup.py build_ext
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    90
0260aeca943c cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents: 123
diff changeset
    91