Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pglock committed Jul 31, 2018
2 parents 49094aa + 5cca81d commit ab18a3f
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 109 deletions.
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
branches:
only:
- master

environment:
skip_non_tags: true

Expand Down
11 changes: 5 additions & 6 deletions doc/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ The following code returns a numpy array with the shape (100, 200).
Reading a multipage tiff file
-----------------------------

A multipage tiff file can be read by iterating over the pages. This can either be done using the tif object as a generator:
A multipage tiff file can be read by iterating over the pages. The `pages` attribute returns a list of pages:

.. code:: python
import pytiff
with pytiff.Tiff("test_data/multi_page.tif") as handle:
for page in handle:
for page in handle.pages:
print("Current shape: {}".format(handle.shape))
current_page = handle[:]
Expand All @@ -78,8 +78,6 @@ or manually:
print("Current shape: {}".format(handle.shape))
current_page = handle[:]
Note that in both cases the "handle" object is set to the last page.

-------------------
Writing a tiff file
-------------------
Expand Down Expand Up @@ -134,8 +132,7 @@ A tiff file can contain many tags. Pytiff supports reading and writing baseline
import pytiff
with pytiff.Tiff("test_data/small_example.tif") as handle:
tags = handle.read_tags()
for k in tags: # or handle.tags
for k in handle.tags:
print("{key}: {value}".format(key=k, value=tags[k]))
Writing tags has to be done before image data is written to the current page.
Expand All @@ -147,6 +144,8 @@ Writing tags has to be done before image data is written to the current page.
handle.set_tags(image_description="Image description")
handle.write(data)
All available tags can be found at `pytiff.tags`.

----------------
More information
----------------
Expand Down
5 changes: 3 additions & 2 deletions pytiff/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
__all__ = ["Tiff", "byteorder", "is_bigtiff", "__version__", "tiff_version", "tiff_version_raw"]
__all__ = ["Tiff", "tags", "NotTiledError", "SinglePageError", "byteorder", "is_bigtiff", "__version__", "tiff_version", "tiff_version_raw"]

from .utils import byteorder, is_bigtiff
try:
from ._pytiff import Tiff
from ._pytiff import Tiff, NotTiledError, SinglePageError, tags
from ._pytiff import __doc__
from ._pytiff import tiff_version, tiff_version_raw
except ImportError as e:
print("Cython modules not available")

from pytiff._version import __version__
Loading

0 comments on commit ab18a3f

Please sign in to comment.