From: kasper <ka...@lo...> - 2012-05-10 08:35:03
|
Hello list, In working with matplotlib in a Python course we discovered an inconsistency in importing various image files. When importing a JPEG file a numpy array containing ints (0-255) is returned, but when a PNG is imported an array containing floats (0-1) is returned. The obvious solution is checking for filetype during read and then dividing by 255, but this seems awkward to do outside the library. Also, as discussed at [1] there is the matter of 16 (or 8+) bit images, which might complicate things. Is there a consensus on how to handle this in code using matplotlib? Kind regards, Kasper Loopstra. [1]: https://github.com/matplotlib/matplotlib/pull/616 |