Giter Club home page Giter Club logo

Comments (9)

napter avatar napter commented on June 24, 2024 1

Why is this marked fixed? @pearu indicated that he applied the patch but I don't see it in the code. The current branch still throws the following error when trying to load a 1 bit TIFF image - "NotImplementedError: bits = 1". It's being thrown by get_numpy_type which raises the error if bits % 8 != 0. Does PyLibTiff not support 1 bit images?

from pylibtiff.

pearu avatar pearu commented on June 24, 2024 1

@blokhin the applied patch is in 8d91479

from pylibtiff.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
I wrote a patch to read group4 binary images... it might not work for other 
compression schemes, and gives an image with inverted colors.

Original comment by [email protected] on 6 Nov 2011 at 12:33

Attachments:

from pylibtiff.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
It works for my images! Thanks for the patch!

Original comment by [email protected] on 6 Nov 2011 at 4:55

from pylibtiff.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Even if it does not provide complete support for 1bit images
(no write support, the returned array is actually 8 bit array
because numpy does not have int1 type available)
I have applied the patch (with slight modification) to svn repo
because the patch is simple and it works for some applications.

Original comment by pearu.peterson on 6 Nov 2011 at 8:46

  • Changed state: Fixed

from pylibtiff.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
There is no int1 type available, but there is numpy.bool for binary vectors...

Original comment by [email protected] on 6 Nov 2011 at 9:03

from pylibtiff.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Sure, but numpy.bool has 8 bits, not 1, and thus it is equivalent to numpy.int8.
This makes writing numpy.bool arrays as 1 bit arrays tricky (need to use
bittools extension module to convert 8bit arrays to 1bit arrays before calling 
WriteStrip).

Original comment by pearu.peterson on 6 Nov 2011 at 9:25

from pylibtiff.

blokhin avatar blokhin commented on June 24, 2024

Unfortunately, the patch is no more available 😢
Dear @pearu may be you have it somewhere archived?

from pylibtiff.

blokhin avatar blokhin commented on June 24, 2024

@pearu ah but then it doesn't work for me, unfortunately:

~# python3 test_tiff.py scanned_bw_multi_page.tif
TIFFReadDirectory: Warning, Unknown field with tag 33579 (0x832b) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 33580 (0x832c) encountered.
Traceback (most recent call last):
  File "test_tiff.py", line 9, in <module>
    image = tif.read_image()
  File "/usr/local/lib/python3.7/dist-packages/libtiff/libtiff_ctypes.py", line 570, in read_image
    typ = self.get_numpy_type(bits, sample_format)
  File "/usr/local/lib/python3.7/dist-packages/libtiff/libtiff_ctypes.py", line 526, in get_numpy_type
    raise NotImplementedError("bits = {0:d}".format(bits))
NotImplementedError: bits = 1

Please see the test image here. May be #82 is related.

from pylibtiff.

Related Issues (20)

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.