File: python-import

package info (click to toggle)
tifffile 20151006-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 328 kB
  • ctags: 330
  • sloc: python: 4,114; ansic: 764; sh: 20; makefile: 16
file content (21 lines) | stat: -rwxr-xr-x 542 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
# autopkgtest check: Try importing tiffile module
# Author: Sascha Steinbiss <satta@debian.org>

import tifffile
import os
import tempfile

print(tifffile.__version__)

tmpdir = tempfile.mkdtemp()
filename = "%s/foo.tiff" % (tmpdir)
os.system("convert -size 100x100 xc:white %s" % (filename))
with tifffile.TiffFile(filename) as tif:
    images = tif.asarray()
    for page in tif:
        for tag in page.tags.values():
            t = tag.name, tag.value
            print(t)
os.unlink(filename)
os.removedirs(tmpdir)