GithubHelp home page GithubHelp logo

pylibtiff's Introduction

=================================
PyLibTiff - a Python tiff library
=================================

:Authors:

  Pearu Peterson <pearu.peterson AT gmail DOT com>

:Website:

  http://pylibtiff.googlecode.com/

:License:

  New BSD License

History
=======

 * Started numpy.memmap wrapper of tiff files in April 2010.
 * Project published on April 22, 2009.

Download
========

The latest release can be downloaded from pylibtiff website.

The latest development code is available via SVN. To check it out,
run::

  svn checkout http://pylibtiff.googlecode.com/svn/trunk/ pylibtiff-svn
  cd pylibtiff-svn

Installation
============

To use pylibtiff, the following is required:

  * Python 2.5 or newer
  * libtiff library
  * nose for running pylibtiff tests

To install pylibtiff, unpack the archive file, change to the
pylibtiff source directory ``pylibtiff-?.?*`` (that contains setup.py
file and pylibtiff module), and run::

  python setup.py install

Testing
=======

To test pure Python pylibtiff from source directory, run::

  nosetests libtiff/tests/

Basic usage
===========

Import pylibtiff with

>>> from libtiff import *

that will provide a class TIFF to hold a tiff file:

>>> tiff = TIFF.open('filename')
>>> image = tiff.read_image()

The TIFF class provides ctypes based wrapper to the C libtiff library.

Additional documentation is available online in Pylibtiff website.

Help and bug reports
====================

You can report bugs at the pylibtiff issue tracker:

  http://code.google.com/p/pylibtiff/issues/list

Any comments and questions can be sent also to the authors.

pylibtiff's People

Contributors

samskillman avatar

pylibtiff's Issues

Setting Resolution tags in header seems broken

What steps will reproduce the problem?

Under Ipython -pylab
import libtiff
yy = (100*rand(100,100) ).astype('int32')
testTiff = libtiff.TIFF.open('brokenHeaders.tiff', 'w')
testTiff.SetField('XRESOLUTION', 1)
testTiff.GetField('XRESOLUTION')

What is the expected output? What do you see instead?
The output should obviously be 1.0 .  I get the same value whether
my input is 1, 100 or any other number as int or float data types.

Instead I see:

out = -0.024263981729745865 

What version of the product are you using? On what operating system?
I'm running Debian linux with KDE.
Python => v.  2.5.2-3
Ipython => v. .8.4.1




Original issue reported on code.google.com by [email protected] on 7 Oct 2009 at 9:46

RGB image format doesn't follow the standard numpy RGB format

write_image() supports RGB image if write_rgb=True is passed, but it expects an 
numpy array in the format 3xMxN for an image of MxN pixels, while the normal 
RGB images in numpy are encoded MxNx3. 

For reference, see the documentation here:
http://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.imread.html

As a workaround, I currently send a view of my array with axes swapped to 
write_image. Like this:
image = scipy.ndimage.imread("test.jpg")
image_sw = image.swapaxes(2,0).swapaxes(2,1)
tif.write_image(image_sw, write_rgb=True)


I can try to provide a patch if you're interested.

Original issue reported on code.google.com by [email protected] on 9 Oct 2012 at 9:03

bittools extension fails to compile on Fedora 18 (python 2.7.3, gcc 4.7.2, numpy 1.7.0)

I checked out rev. 89 from svn and attempted to build from source in the usual 
way (python setup.py build / sudo python setup.py install), but the build 
choked on the bittools extension. A log is attached. It looks as though the 
problem may be numpy-1.7.0-related. (I just watched someone successfully 
install on an Ubuntu 12.04 system with numpy 1.6.2, same gcc and python.)

Original issue reported on code.google.com by [email protected] on 10 Apr 2013 at 1:33

Attachments:

error in importing libtiff

I am trying to use pylibtiff to read tiff files into numpy array.. i installed 
the windows installer provided on the site and now if i try importing, python 
encounters with following error:

>>> from libtiff import *

Traceback (most recent call last):
  File "D:/Python27/testtifflib.py", line 4, in <module>
    from libtiff import *
  File "D:\Python27\lib\site-packages\libtiff\__init__.py", line 4, in <module>
    from .libtiff import libtiff, TIFF
  File "D:\Python27\lib\site-packages\libtiff\libtiff.py", line 35, in <module>
    raise ImportError('Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|..')
ImportError: Failed to find TIFF library. Make sure that libtiff is installed 
and its location is listed in PATH|LD_LIBRARY_PATH|..

i also tried this :

import sys
sys.path.append("D:\\Python27\\Lib\\site-packages\\libtiff")

from libtiff import *

but same error persists.. what can be done in this case??  any help is 
appreciated.. m i missing something here??


Original issue reported on code.google.com by [email protected] on 2 Feb 2011 at 12:35

Segmentation fault at "from libtiff import TIFF" / dlopen(...tif_lzw.so") with python 2.6

What steps will reproduce the problem?
1. run enthought python distribution 6.3-2 on scientific linux 5
2. build/install pylibtiff (revision 70)
3. run python -c "from libtiff import TIFF"

What is the expected output? What do you see instead?
$ python -v -d -c "from libtiff import TIFF"
....

import copy # precompiled from /scratch/epd-6.3-2-rh5-x86/lib/python2.6/copy.pyc
# /scratch/pylibtiff.i386/lib/python/libtiff/tiff_base.pyc matches 
/scratch/pylibtiff.i386/lib/python/libtiff/tiff_base.py
import libtiff.tiff_base # precompiled from 
/scratch/pylibtiff.i386/lib/python/libtiff/tiff_base.pyc
# /scratch/pylibtiff.i386/lib/python/libtiff/lsm.pyc matches 
/scratch/pylibtiff.i386/lib/python/libtiff/lsm.py
import libtiff.lsm # precompiled from 
/scratch/pylibtiff.i386/lib/python/libtiff/lsm.pyc
dlopen("/scratch/pylibtiff.i386/lib/python/libtiff/tif_lzw.so", 102);
Segmentation fault



What version of the product are you using? On what operating system?

$ python -V
Python 2.6.6 -- EPD 6.3-2 (32-bit)

$ uname -a
Linux pc6490 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:56:26 EST 2010 i686 i686 
i386 GNU/Linux


Please provide any additional information below.

Works o.k. with python 2.7. 


Original issue reported on code.google.com by [email protected] on 19 Jan 2011 at 2:17

Tiff Exploit For PSP

Hi

We are founded exploit for psp system but sony patched it please make same 
this for me 


Exp:http://www.multiupload.com/EKU1LXZDWW (same this)

Sorry for my english




Original issue reported on code.google.com by [email protected] on 15 May 2010 at 8:41

Cannot be installed with Python3 (even after 2to3 translator)

What steps will reproduce the problem?

1. direct installation with pip3 or easy_install returns a problem with `print`

2. after translation of the code with `2to3` the problem with `_bitarray.c` 
arises:

    bitarray-0.3.5-numpy/bitarray/_bitarray.c:2520:17: error: ‘PyTypeObject’ has no member named ‘ob_type’
         Bitarraytype.ob_type = &PyType_Type;

Original issue reported on code.google.com by [email protected] on 21 Mar 2015 at 7:57

http://openjpeg.googlecode.com/svn/dev-utils/scripts/generate_big_files.sh

Please add support for the new libtiff 4.0.1 which adds BigTiff support.

Issues is:


>>> import libtiff
Generating '/usr/lib/python2.7/dist-packages/libtiff/tiff_h_4_0_1.py'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/libtiff/__init__.py", line 20, in <module>
    from .libtiff_ctypes import libtiff, TIFF
  File "/usr/lib/python2.7/dist-packages/libtiff/libtiff_ctypes.py", line 87, in <module>
    f = open(fn, 'w')
IOError: [Errno 13] Permission denied: 
'/usr/lib/python2.7/dist-packages/libtiff/tiff_h_4_0_1.py'
>>> 


Thanks

Original issue reported on code.google.com by mathieu.malaterre on 11 Mar 2012 at 4:40

Writing a field with an empty string segfault with the C wrapper

What steps will reproduce the problem?
>>> from libtiff import TIFF
>>> import numpy
>>> tif = TIFF.open('filename.tif', mode='w')
>>> tif.SetField("ImageDescription", "")
Segmentation fault (core dumped)

What is the expected output? What do you see instead?
>>> from libtiff import TIFF
>>> import numpy
>>> tif = TIFF.open('filename.tif', mode='w')
>>> tif.SetField("ImageDescription", "")
>>> tif.write_image(numpy.zeros((20,20)))
>>> tif.close()

$ tiffinfo filename.tif 
TIFF Directory at offset 0xc88 (3208)
  Image Width: 20 Image Length: 20
  Bits/Sample: 64
  Sample Format: IEEE floating point
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Orientation: row 0 top, col 0 lhs
  Planar Configuration: single image plane
  ImageDescription: 



What version of the product are you using? On what operating system?
svn HEAD (rev 93) (on Ubuntu 12.04)

Please provide any additional information below.
This is due to the SetField() wrapper which is confused because Python strings 
are iterable, but ctype needs to convert them as a simple type.

Attached is a patch that fixes this. This patch can also be found here: 
https://github.com/delmic/pylibtiff/commit/9bbdd48321dacbe0be418adf77c2cc063c355
8ab

PS: the patch also fixes a few other minor issues, let me know if you prefer a 
patch which does only the very minimum to fix this issue.

Original issue reported on code.google.com by [email protected] on 21 Aug 2013 at 4:29

Attachments:

import libtiff fails

--problem--:
1) can't eval (1
2) TIFFTAG_* undefined

--solution--:
sed -i "s/\.split()\[:2\]/\.split(None,1)/;\
      s/eval(value)/eval(value,d)/" libtiff/libtiff_ctypes.py

python=2.7.3
libtiff=4.0.3

Original issue reported on code.google.com by [email protected] on 16 Oct 2012 at 10:13

Reading tiffarray of large images

What steps will reproduce the problem?
from libtiff import TIFFfile
tif=TIFFfile("3D_sliced_tiff_image_of_800MB.tiff")
tif.get_tiff_array()[:]

What is the expected output? What do you see instead?
I expect a 3D array
I get IndexError: tuple index out of range from the line 35 (function 
__get_item__(self, index) of tiff_array.py :
indices = range (*index.indices(self.shape[0]))

What version of the product are you using? On what operating system?
/pylibtiff-0.3.0.dev78-py2.7
on Ubuntu 11.10

Please provide any additional information below.
The function works on the same image if I crop it before (800MB to 200MB)

Original issue reported on code.google.com by [email protected] on 2 Feb 2012 at 2:39

README.txt is out-of-date

The readme file says to import with
from pylibtiff import *

The correct import is
from libtiff.libtiff import *

Original issue reported on code.google.com by [email protected] on 4 Jan 2010 at 10:27

Fail to import libtiff in Ubuntu 14.04

What steps will reproduce the problem?
1.import libtiff


What is the expected output? What do you see instead?
Failed to find TIFF header file (may be need to run: sudo apt-get install 
libtiff4-dev)

What version of the product are you using? On what operating system?
Ubuntu 14.04

Please provide any additional information below.
Ubuntu 14.04 come with libtiff5 by default, replace it with libtiff4 seems not 
a simple task since several hundreds of package depends on libtiff5.

Original issue reported on code.google.com by [email protected] on 10 Sep 2014 at 8:50

Let's put pylibtiff on PyPI so that other packages can install it as a dependency.

Can pylibtiff join the Python Package Index at pypi.python.org/pypi so that 
it's easy for other packages to depend on it? If you're not sure you have the 
time, I'd be happy to upload it myself and send you the relevant authentication 
info.

I maintain a package called PIMS (https://github.com/soft-matter/pims) that 
uses pylibtiff and other libraries to read sequential images in various formats 
using a consistent interface.

Once pylibtiff is on PyPI it will be possible to

   pip install pylibtiff

and then I can set it up such that

    pip install pims

automatically installs pylibtiff as well. Thanks!

Dan Allan

Original issue reported on code.google.com by [email protected] on 13 Sep 2014 at 6:03

incorrectly imports big-endian 16bit uints

What steps will reproduce the problem?
1. load data from a big-endian uint16 file

What is the expected output? What do you see instead?

It looks like the bytes are not swapped so the returned values are in the bit 
order ([8, 9, .. 15, 0, 1, ... 7]).  

There is already a function `IsByteSwapped` which will determine if the swap is 
needed.  

What version of the product are you using? On what operating system?

 master, linux

See test images at 
https://github.com/soft-matter/pims/blob/master/pims/tests/data/stuck.tif

Original issue reported on code.google.com by [email protected] on 28 Jan 2014 at 3:23

Does work for 1bit compressed TIFF

It seems that the library is working well for greyscale and color images, but 
as soon as a pure black&white (1bit/1plan) is given, it fails and renders a 
totally black image

I suppose there is something to do in read_image function cause I saw some 
comments in the code saying "TODO: check for correctness"




Original issue reported on code.google.com by [email protected] on 11 Mar 2011 at 4:07

libtiff 4.x and custom tags

What steps will reproduce the problem?
1. Add custom tags of specific data type using the "add_tags" function in 
libtiff_ctypes.py
2. Read or write file with these custom tags.
3. Get segmentation fault or assert(0)

What is the expected output? What do you see instead?
With libtiff 3.9 there are no segmentation faults or assertion errors or other 
crashes.

Please use labels and text to provide additional information.
I originally added the custom tag functionality to libtiff_ctypes.py. I was 
updating some of my environments that use pylibtiff with libtiff 4.0.3 and 
found that the tests at the bottom of libtiff_ctypes cause a segmentation fault 
that seems to be linked to the custom tag test. Also, when using custom tags 
there seems to be certain types that aren't supported in the new libtiff layout 
which results in an assert(0) error. One specific example is a tag with type 
"TIFF_SLONG" will be assigned an internal type of "TIFF_SETGET_SINT32", but the 
code to handle this type does not exist later in the library calls.

I think the "correct" decision is to update libtiff_ctypes to check the version 
of libtiff used and if 4.0+ use the new functions for adding custom tags. The 
problem with that is I don't think there is any documentation for creating 
custom tags in 4.0. I've asked the libtiff mailing list for any advice and I'll 
go from there.

Original issue reported on code.google.com by [email protected] on 17 Feb 2015 at 4:10

Support for EXIF tags

I added basic EXIF tag support, which gets the job done but definitely needs 
work.

It just detects if TIFFTAG_EXIFIFD exists, and loads it by looping through the 
IFD loading loop (in tiff_file.py) one last time with the proper offset. Thus 
the additional code added is quite minimal. Also in the patch is a change to 
tiff_data.py which includes EXIF tag info. Not all of them though, I just added 
the main ones that were in my photos. The complete list is located at: 
http://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif.html

Attached is the patch, test program, and sample output.

Original issue reported on code.google.com by [email protected] on 25 Aug 2011 at 10:32

Attachments:

fails to compile (Windows 7, VS2008, Python 2.7, numpy 1.6.1)

I run on SVN checkout:
python setup.py install

and got:
libtiff\src\tif_lzw.c(1276) : error C2036: 'void *' : unknown size

reason:

In numpy c interface (see 
https://github.com/numpy/numpy/blob/master/numpy/core/include/numpy/ndarraytypes
.h) was changed the return type of PyArray_DATA from void* in 1.6.1. to char* 
in current git head revision. PyArray_DATA also changed from macro to inline 
function but that should not matter.

Is it possible that pylibtiff works with current numpy from github and not with 
last stable numpy release?

I attach patch that allowed me to compile pylibtiff (the functionality is not 
tested). Also the installation log is attached.

Original issue reported on code.google.com by [email protected] on 7 Nov 2011 at 6:07

Attachments:

Failure to import tif_lzw

What steps will reproduce the problem?
1. I am using the Canopy Python installation v 1.1.1.1452, which includes 
Enthought Canopy Python 2.7.3 | 64-bit [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] 
on linux2. I also installed tiff-4.0.3 from source. I set LD_LIBRARY_PATH to 
include the Enthought Python lib directory, and subsequently the libtiff 
directory in site-packages.
2. I downloaded pylibtiff using 'svn checkout 
http://pylibtiff.googlecode.com/svn/trunk/ pylibtiff-read-only' and ran python 
setup.py install. 
3. I ran nosetests libtiff/tests/ from the pylibtiff-read-only directory.

What is the expected output? What do you see instead?
I get the following output with an import error for tif_lzw.:

$ nosetests libtiff/tests/
EEEEE
======================================================================
ERROR: Failure: ImportError (No module named tif_lzw)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tests/test_lzw.py", line 4, in <module>
    from libtiff import TIFFfile, TIFF
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/__init__.py", line 21, in <module>
    from .tiff import TIFFfile, TIFFimage, TiffArray
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff.py", line 25, in <module>
    from .tiff_file import TIFFfile
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_file.py", line 20, in <module>
    from .tiff_sample_plane import TiffSamplePlane
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_sample_plane.py", line 8, in <module>
    import tif_lzw
ImportError: No module named tif_lzw

======================================================================
ERROR: Failure: ImportError (No module named tif_lzw)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tests/test_simple.py", line 5, in <module>
    from libtiff import TIFF
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/__init__.py", line 21, in <module>
    from .tiff import TIFFfile, TIFFimage, TiffArray
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff.py", line 25, in <module>
    from .tiff_file import TIFFfile
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_file.py", line 20, in <module>
    from .tiff_sample_plane import TiffSamplePlane
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_sample_plane.py", line 8, in <module>
    import tif_lzw
ImportError: No module named tif_lzw

======================================================================
ERROR: Failure: ImportError (No module named tif_lzw)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tests/test_tiff_array.py", line 6, in <module>
    from libtiff import TIFF
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/__init__.py", line 21, in <module>
    from .tiff import TIFFfile, TIFFimage, TiffArray
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff.py", line 25, in <module>
    from .tiff_file import TIFFfile
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_file.py", line 20, in <module>
    from .tiff_sample_plane import TiffSamplePlane
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_sample_plane.py", line 8, in <module>
    import tif_lzw
ImportError: No module named tif_lzw

======================================================================
ERROR: Failure: ImportError (No module named tif_lzw)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tests/test_tiff_file.py", line 6, in <module>
    from libtiff import TIFF
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/__init__.py", line 21, in <module>
    from .tiff import TIFFfile, TIFFimage, TiffArray
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff.py", line 25, in <module>
    from .tiff_file import TIFFfile
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_file.py", line 20, in <module>
    from .tiff_sample_plane import TiffSamplePlane
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_sample_plane.py", line 8, in <module>
    import tif_lzw
ImportError: No module named tif_lzw

======================================================================
ERROR: Failure: ImportError (No module named tif_lzw)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/rosborn/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tests/test_tiff_image.py", line 5, in <module>
    from libtiff import TIFFfile, TIFFimage, TIFF
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/__init__.py", line 21, in <module>
    from .tiff import TIFFfile, TIFFimage, TiffArray
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff.py", line 25, in <module>
    from .tiff_file import TIFFfile
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_file.py", line 20, in <module>
    from .tiff_sample_plane import TiffSamplePlane
  File "/autonfs/home/rosborn/downloads/pylibtiff-read-only/libtiff/tiff_sample_plane.py", line 8, in <module>
    import tif_lzw
ImportError: No module named tif_lzw

----------------------------------------------------------------------
Ran 5 tests in 0.449s

FAILED (errors=5)

If I succeed in suppressing the tif_lzw import error (by commenting out the 
imports), I get a segmentation fault.

Original issue reported on code.google.com by [email protected] on 30 Oct 2013 at 6:58

Enhance parsing of tiff.h

I had patched r87 myself when I got a new libtiff on fedora 18.  Hadn't got 
around to submitting the patch though.  I noticed it got fixed in svn but 
thought I'd add a minor detail.

In the svn version exceptions are raised when header refers to values already 
defined instead of using numbers.  Adding the value dict back to the eval 
statement allows those to be parsed and added to the value instead of raising.  
Also using re makes a few less lines of code needed to get the right values 
into the words.

Not a big deal.. just thought I'd submit anyway.

Index: libtiff/libtiff_ctypes.py
===================================================================
--- libtiff/libtiff_ctypes.py   (revision 93)
+++ libtiff/libtiff_ctypes.py   (working copy)
@@ -13,6 +13,7 @@
 __all__ = ['libtiff', 'TIFF']

 import os
+import re
 import sys
 import numpy as np
 from numpy import ctypeslib
@@ -71,10 +72,7 @@
     d = {}
     for line in f.readlines():
         if not line.startswith('#define'): continue
-        words = line[7:].lstrip().split()
-        if len(words)>2:
-            words[1] = ''.join(words[1:])
-            del words[2:]
+        words = re.split( "\s*", line[7:].strip(), 1 )
         if len (words)!=2: continue
         name, value = words
         i = value.find('/*')
@@ -82,11 +80,7 @@
         if value in d:
             value = d[value]
         else:
-            try:
-                value = eval(value)
-            except:
-                print `value, line`
-                raise
+            value = eval(value,d)
         d[name] = value
         l.append('%s = %s' % (name, value))
     f.close()

Original issue reported on code.google.com by [email protected] on 14 Jun 2013 at 4:40

TIFFimage and RGB

is it possible to write RGB tiff files by means of python module ?

i can only obtain a GRAY file with width multiplied by 3.

i quickly read sources and i don't understand how to set photometric and 
samplesperpixel tags.


Original issue reported on code.google.com by [email protected] on 23 Aug 2011 at 10:28

TIFF.read_image() fails to read RGB images

TIFF.read_image() only works with grey-scale images. When attempting to read a 
RGB image, it only returns the R channel (in separate plane config) or the  
first third of the data (in contiguous plane config).

The SamplesPerPixel field must be taken into account, and if it's more than 1, 
the returned array must be a 3D array.

This is what the attached patch does. It handles both contiguous and separate 
plane configs. 

The patch is also available as a git commit here:
https://github.com/delmic/pylibtiff/commit/94eabe3b063d1d245d46c67adbe91604b944b
a0e

Original issue reported on code.google.com by [email protected] on 5 Aug 2013 at 2:17

Attachments:

Unknown TIFF tags

TIFFReadDirectory: Warning, Unknown field with tag 33550 (0x830e) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 33922 (0x8482) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 34735 (0x87af) encountered.

What steps will reproduce the problem?
1. open
2. read_image

What is the expected output? What do you see instead?
No warnings

What version of the product are you using? On what operating system?
Windows 7/64, Python 2.7

Please provide any additional information below.
Sample file attached

Original issue reported on code.google.com by [email protected] on 17 Aug 2013 at 2:30

Attachments:

tests fail on all os.remove() on Windows

Temporary files are locked on Windows, so they can not be removed without 
closing beforehand.

Log file of nosetests on Windows 7, VS2008, Python 2.7 attached. 

I tried to fix the error by calling .close() method on objects that opened the 
files, deleting mmaped variables and/or TIFFfile or TIFFimage instances before 
calling os.remove(). It didn't solve the issue unfortunately. The mmaped numpy 
arrays are somehow still open.

Original issue reported on code.google.com by [email protected] on 8 Nov 2011 at 9:06

Attachments:

TIFF.write_image writes incorrect ORIENTATION tag

What steps will reproduce the problem?
1.  Write image data using TIFF.open(filename, 'w').write(data)

What is the expected output? What do you see instead?

The created diff file has orientation 6 (

The offending lines are in libtiff_ctypes.py, lines 403, 420, and 453:

self.SetField(TIFFTAG_ORIENTATION, ORIENTATION_RIGHTTOP)

The correct value is 1, not 6.  See, for example,

http://www.awaresystems.be/imaging/tiff/tifftags/orientation.html

Note also that simply not setting the orientation tag also results in a correct 
image.

What version of the product are you using? On what operating system?

pylibtiff 0.1svn, Linux Ubuntu 10.10


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 25 Nov 2011 at 10:14

how pylibtiff can work in Windows Xp system?

1,I download the libtiff.py and setup.py  ,after I install then in my  win 
XP system ,it also have some problem with me,I find the no.21 line of the 
libtiff.py file,the script of it is "include_tiff_h 
= '/usr/include/tiff.h'",   this path is in linux system ,so I think 
that ,can this tool work in Xp system?

Original issue reported on code.google.com by [email protected] on 27 Sep 2009 at 12:26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.