Skip to main content
Tiffany - Read/Write Multipage-Tiff with PIL without PIL
========================================================

Tiffany stands for any tiff. The tiny module solves a large set of
problems, has no dependencies and just works wherever Python works.
Tiffany was developed in the course of the *Pydica* project and will
now appear on PyPi.

Abstract
========

During the development of *Pydica* (Python Distributed Capture) we were
confronted with the problem to read multipage Tiff scans. The GUI toolkit
*PySide (Qt)* does support Tiff, but only shows the first page. We also had
to support Fax compression (CCITT G3/G4), but *Qt* supports this.

As a first approach we copied single pages out of multi-page tiff files
using *tiffcp* or *tiffutil* (OS X) as a temp file for display. A sub-optimum
solution, especially for data security reasons.

The second approach replaced this by a tiny modification of the linkage of
the tiff directories (IFD). This way, a tiff file could be patched in memory
with the wanted page offset and then be shown without any files involved.

Unfortunately also this solution was not satisfactory:

- our tiff files have anomalies in their tiff tags like too many null-bytes
and wrong tag order,

- Qt's implementation of tiff is over-pedantic and ignores all tags after the
smallest error.

Being a good friend of *Fredrik Lundh* and his *PIL* since years, I tried to
attack the problem using this. Sadly Fredrik hasn't worked much on this since
2006, and the situation is slightly messed up:

*PIL* has a clean-up of tiff tags, but cannot cope with fax compression by default.
There exists a patch since many years, but this complicates the build process
and pulls with *libtiff* a lot of dependencies in.

Furthermore, *PIL* is unable to write fax compressed files, but blows the data
up to the full size, making this approach only a half solution as well.

After a longer odyssey I saw then the light of a Tiffany lamp:

I use only a hand-full of *PIL*s files, without any modification, pretend to unpack
a tiff file, but actually cheating. Only the tiff tags are nicely processed and
streamlined, but the compressed data is taken unmodified as-is.
When writing a tiff page out, the existing data is just assembled in the correct
order.

For many projects like *Pydica* that are processing tiff files without editing
their contents, this is a complete solution of their tiff problem. The dependencies
of the project stay minimal, there are no binaries required, and Tiffany is with
less than 300 lines remarkably small.

Because just 5 files from *PIL* are used and the _imaging module is not compiled
at all, I'm talking about "PIL without PIL" ;-)

Tiffany is a stand-alone module and has no interference with *PIL*.
You can see this by looking at ``import_mapper.py``. This module modifies ``__import__``
so that the *PIL* modules appear as top-level internally, but become sub-modules of
tiffany in ``sys.modules``.

Please let me know if this stuff works for you, and send requests to
<tismer@stackless.com> or use the links in the bitbucket website:

https://bitbucket.org/pydica/tiffany

easiest way to install tiffany:

``$ pip install tiffany``

# EOF

Metadata

Release files for tiffany 0.6.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tiffany 0.6.7
File Size Uploaded
tiffany-0.6.7.tar.gz 197.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for tiffany 0.6.7
File Interpreter ABI Platform
tiffany-0.6.7-py3-none-any.whl Python 3 none any Details
tiffany-0.6.7-py2-none-any.whl Python 2 none any Details

Total release size: 601.4 kB

Release files / tiffany-0.6.7.tar.gz

Download URL tiffany-0.6.7.tar.gz
Size 197.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cc1397030989be5ad5a87fb744c0e38bfa31c017cd2ba48713127403f201f5f3
BLAKE2b-256 checksum
How to use checksums
3626411152b86429dfd4cac373e15862641d0b10146a370b7bc8db5fcabed379
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / tiffany-0.6.7-py3-none-any.whl

Download URL tiffany-0.6.7-py3-none-any.whl
Size 202.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c4172893b8924fd5e29754f35e79a1f13b9817d5a632270ebf5e1b7fac9d954
BLAKE2b-256 checksum
How to use checksums
ff22ec7f90444df5c8454a2f74d9123dcfe73aac9b0b4bcbe3cd3644867fe6e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / tiffany-0.6.7-py2-none-any.whl

Download URL tiffany-0.6.7-py2-none-any.whl
Size 202.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
81d39b7fd9c834b7f4b5bec163ce23a41d2c88e9cfbe604cc2db7728b280e5db
BLAKE2b-256 checksum
How to use checksums
49cfb9d71db83f162c3db9c5ee5199be50f7ef96e9ef3fb9c8129dc1e4813315
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.6.7 This release

3 release files

0.6.6

3 release files

0.6.5

1 release file

0.6.4

0.6.3

0.6.2

0.6.1

0.6

0.5

0.4

0.3

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page