You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The combination of doing a seek and read (in this order) causes MagickReadImageFile to consistently return 0. The following code requires that there is an image wand.png. It has three test cases: the first two run successfully and the third one fails after doing a seek-read-seek.
from wand.image import Image
fn = 'wand.png'
# This works as expected
fp = open(fn)
try:
fp.read(1)
fp.seek(0)
with Image(file=fp) as img:
print '%s could be opened with read-seek' % img.format
finally:
fp.close()
# This is a workaround that fixes the issue, but I have no idea why a flush
# would change a file that has not been written to.
fp = open(fn)
try:
fp.seek(0)
fp.read(1)
fp.flush()
fp.seek(0)
with Image(file=fp) as img:
print '%s could be opened with seek-read-flush-seek' % img.format
finally:
fp.close()
# This fails
fp = open(fn)
try:
fp.seek(0)
fp.read(1)
fp.seek(0)
with Image(file=fp) as img:
print '%s could be opened with seek-read-seek' % img.format
finally:
fp.close()
Here is the output that I get:
PNG could be opened with read-seek
PNG could be opened with seek-read-flush-seek
Traceback (most recent call last):
File "./test.py", line 34, in <module>
with Image(file=fp) as img:
File "/usr/local/lib/python2.7/dist-packages/wand/image.py", line 1979, in __init__
self.read(file=file, resolution=resolution)
File "/usr/local/lib/python2.7/dist-packages/wand/image.py", line 2048, in read
self.raise_exception()
File "/usr/local/lib/python2.7/dist-packages/wand/resource.py", line 222, in raise_exception
raise e
wand.exceptions.MissingDelegateError: no decode delegate for this image format `/tmp/magick-ZEtTP5H0' @ error/constitute.c/ReadImage/544
I've traced the problem back to the call to MagickReadImageFile returning 0 in wand/image.py:2029. Different images and a new virtualenv made no change. I am on the latest stable version of Wand (0.3.9) and on:
>>> print(sys.version)
2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1]
At the moment I am just really curious what is going on internally. Thanks for doing an awesome job!
The combination of doing a seek and read (in this order) causes
MagickReadImageFile
to consistently return 0. The following code requires that there is an image wand.png. It has three test cases: the first two run successfully and the third one fails after doing a seek-read-seek.Here is the output that I get:
I've traced the problem back to the call to
MagickReadImageFile
returning 0 inwand/image.py:2029
. Different images and a new virtualenv made no change. I am on the latest stable version of Wand (0.3.9) and on:At the moment I am just really curious what is going on internally. Thanks for doing an awesome job!
Edit: My guess is that the problem originates from magick_wand.c:6837.
The text was updated successfully, but these errors were encountered: