io.imsave() problems with passing arguments to plugin "freeimage"

Christoph Gohlke cjgohlke at gmail.com
Thu Jul 12 13:39:52 EDT 2012


The freeimage plugin is comparing numpy's dtype.type (not dtype), which 
apparently does not work in this case:

import numpy as np
one = np.ones([2048,2048],dtype=np.int32)
two = np.zeros([2048,2048],dtype=np.int32)
summation = one + two

assert repr(summation.dtype) == repr(one.dtype)
assert summation.dtype == one.dtype
assert hash(summation.dtype) == hash(one.dtype)

assert repr(summation.dtype.type) == repr(one.dtype.type)
assert summation.dtype.type != one.dtype.type
assert hash(summation.dtype.type) != hash(one.dtype.type)


I submitted a PR at 
<https://github.com/scikits-image/scikits-image/pull/214>

Christoph



On 7/12/2012 7:09 AM, Zachary Pincus wrote:
> This is very curious. You have two arrays of identical dtype (that is, "two" and "summation"), and one can be saved via freeimage yet the other cannot? Is this correct?
>
> Hopefully someone can try to verify this. Strange, too, that it would fail on XP but work on Win 7 32-bit. Perhaps that's a red herring and it has to do with the EPD version?
>
>
> On Jul 12, 2012, at 8:41 AM, Sigmund wrote:
>
>>
>>
>> On Wednesday, July 11, 2012 2:50:11 PM UTC+2, Zachary Pincus wrote:
>> I wonder if this has to do with the type-promotion behavior changes in a recent numpy version? What is the dtype of "summation" below?
>>
>> two.dtype and summation.dtype return "int32"  .dtype.type is returning "<type 'numpy.int32'>" in both cases.
>> I just tried it on a diffrent PC. Same problem on a Win32 XP 32bit system with EPD 7.2-2 Python 2.7.2
>>
>> In summary.
>> It is working on :
>> Python 2.7.1 |EPD 7.0-2 (32-bit)| Win 7 32
>> Python 2.7.2 |EPD 7.2-2 (64-bit)| Mac OSX
>> And not working on:
>> Python 2.7.3 |EPD 7.3-1 (64-bit)| Win 7 64
>> Python 2.7.2 IEPD 7.2-2 (32-bit)| Win XP
>>
>> On Jul 10, 2012, at 9:35 AM, Sigmund wrote:
>>
>>> Hey!
>>>
>>> Whil writing the test code I found out that saving the array by itself doesn't cause the error. Only after summing two arrays it fails.
>>>
>>> import numpy as np
>>> import skimage.io as io
>>> io.use_plugin("freeimage", "imread")
>>> one = np.ones([2048,2048],dtype=np.int32)
>>> two = np.zeros([2048,2048],dtype=np.int32)
>>> summation = one + two
>>> io.imsave("test.tif",summation, plugin="freeimage")
>>>
>>>   not using the freeimage plugin in not failing.
>>>
>>> Siggi
>>
>>
>
>
>




More information about the scikit-image mailing list