terom@132: # libpngtile terom@28: terom@28: Constant-time/memory tile-based handling of large PNG images. terom@28: terom@132: ## About terom@132: pngtile is a C library (and associated command-line utility) offering efficient random access to partial regions of terom@28: very large PNG images (gigapixel range). terom@28: terom@28: For this purpose, the library linearly decodes the PNG image to an uncompressed memory-mapped file, which can then terom@28: be later used to encode a portion of this raw pixel data back into a PNG image. terom@28: terom@132: ## Notes terom@28: The command-line utility is mainly intended for maintining the image caches and testing, primary usage is expected terom@28: to be performed using the library interface directly. A simple Cython wrapper for a Python extension module is terom@28: provided under python/. terom@28: terom@28: There is a separate project that provides a web-based tile viewer using Javascript (implemented in Python as a terom@28: WSGI application). terom@28: terom@73: The .cache files are not portable across different architectures, nor are they compatible across different cache terom@73: format versions. terom@73: terom@73: The library supports sparse cache files. A pixel-format byte pattern can be provided with --background using terom@73: hexadecimal notation (--background 0xFFFFFF - for 24bpp RGB white), and consecutive regions of that color will terom@73: be omitted in the cache file, which may provide significant gains in space efficiency. terom@29: terom@132: ## Build terom@28: The library depends on libpng and pthreads. The code was developed and tested using: terom@132: terom@132: * libpng12-dev png.h 1.2.15~beta5-3ubuntu0.1 terom@132: * libc6-dev pthread.h NPTL 2.7 (glibc 2.7-10ubuntu5) terom@28: terom@156: To compile: terom@28: terom@132: $ make terom@132: terom@123: The libpngtile.so and pypngtile.so libraries will be placed under lib/, and the 'pngtile' binary under bin/. terom@123: terom@132: ## Usage terom@28: Store the .png data files in a directory. You must have write access to the directory when updating the caches, terom@28: which are written as a .cache file alongside the .png file. terom@28: terom@28: Provide any number of *.png paths as arguments to the ./bin/util command. Each will be opened, and automatically terom@28: updated if the cache doesn't exist yet, or is stale: terom@28: terom@74: pngtile -v data/*.png terom@73: terom@73: Use -v/--verbose for more detailed output. terom@73: terom@28: terom@74: To render a tile from some image, provide appropriate -W/-H and -x/-y options to pngtile: terom@28: terom@74: pngtile data/*.png -W 1024 -H 1024 -x 8000 -y 4000 terom@28: terom@28: The output PNG tiles will be written to temporary files, the names of which are shown in the [INFO] output. terom@28: terom@28: terom@28: To force-update an image's cache, use the -U/--force-update option: terom@28: terom@74: pngtile --force-update data/*.png terom@28: terom@73: Alternatively, to not update an image's cache, use the -N/--no-update option. terom@28: terom@132: ## Issues terom@28: At this stage, the library is primarily designed to handle a specific set of PNG images, and hence does not support terom@28: all aspects of the PNG format, nor any other image formats. terom@28: terom@28: The pt_images opened by main() are not cleaned up before process exit, due to the asynchronous nature of the tile terom@28: render operation's accesses to the underlying pt_cache object. terom@28: terom@132: # pypngtile terom@132: terom@132: Python extension for pngtile terom@132: terom@132: ## Dependencies terom@132: terom@132: * python-cython terom@132: * python-dev terom@132: terom@157: ## Development terom@132: terom@132: $ python setup.py build_ext terom@132: terom@157: ## Install terom@163: $ virtualenv /opt/pngtile terom@163: $ make -B install PREFIX=/opt/pngtile terom@163: $ /opt/pngtile/bin/pip install -r requirements.txt terom@157: $ /opt/pngtile/bin/python setup.py build_ext -I /opt/pngtile/include -L /opt/pngtile/lib -R /opt/pngtile/lib terom@157: $ /opt/pngtile/bin/python setup.py install terom@132: terom@157: