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
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to