flrs / blend_modes

Python package that implements image blend modes
MIT License
140 stars 28 forks source link

Dtype checks should use dtype.kind instead of == #1

Closed Erotemic closed 6 years ago

Erotemic commented 6 years ago

In at least one place this package checks that

assert img_in.dtype == np.float,

On some platforms this forces images to be of dtype np.float32 and on others they must be np.float64 because np.float is just an alias for the native floating type on the system. This library should assert floating type input, but it should not care if it is a 32 or 64 bit float.

The fix is to replace all code of the previous style with:

assert img_in.dtype.kind == 'f'

with will work with both float32 and float64 types.

flrs commented 6 years ago

Hi @Erotemic, thanks for the suggestion! I just fixed this.