Comments (9)
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.
@blokhin the applied patch is in 8d91479
from pylibtiff.
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.
It works for my images! Thanks for the patch!
Original comment by [email protected]
on 6 Nov 2011 at 4:55
from pylibtiff.
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.
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.
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.
Unfortunately, the patch is no more available 😢
Dear @pearu may be you have it somewhere archived?
from pylibtiff.
@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)
- tiff_file.py imports deprecated numpy module
- tiff_file.py imports deprecated numpy module
- wheel creation? HOT 1
- Missing numpy dependency when installing via pip HOT 4
- Clean up loading of libtiff.dll's HOT 2
- libtiff4 vs libtiff5 & finding header. HOT 5
- Update existing tiff: add new tag HOT 1
- Add debug logging which libtiff.dll is actually used
- Tiled multi-page tiff corrupted?
- Bundled bitarray appears to not be Python 3.11 compatible HOT 8
- Use of deprecate `np.bool`
- Looking for maintainers? HOT 7
- Proposed updates to CI testing and release creation HOT 5
- Possible to specify RGB and YCbCr colorspaces?
- simple tiff files operations
- Failed to install pylibtiff using conda-forge HOT 9
- Unable to open image with Chinese path using TIFF.open HOT 46
- optparse_gui cannot be imported correctly on Windows HOT 6
- Libtiff.info CLI : "ValueError: 'gtkagg' is not a valid value for backend" . HOT 1
- Python >=3.11.5 ImportError: Failed to find TIFF library HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylibtiff.