Re: [matplotlib-devel] Strange bit-depth PNGs

2009-06-22 Thread Michael Droettboom
Tobias Wood wrote: > Michael, > Thanks for the comments, much appreciated. I've attached an updated > patch including your suggestions and some more whitespace for > readability. There was no reason other than simplicity for not > returning a 8-bit numpy array. I actually meant to ask about the

Re: [matplotlib-devel] Strange bit-depth PNGs

2009-06-22 Thread Tobias Wood
Michael, Thanks for the comments, much appreciated. I've attached an updated patch including your suggestions and some more whitespace for readability. There was no reason other than simplicity for not returning a 8-bit numpy array. I actually meant to ask about the ternary blocks - I think

Re: [matplotlib-devel] Strange bit-depth PNGs

2009-06-22 Thread Michael Droettboom
I don't ever work with data-in-PNGs, so I won't comment on the use cases or API here -- I'll leave that to others. However, for the patch, I think the reinterpret_cast would be safer as reinterpret_cast, since unsigned ints are not guaranteed to be 16-bits, and png.h provides a nice convenient

[matplotlib-devel] Strange bit-depth PNGs

2009-06-22 Thread Tobias Wood
Dear list, Back in April I submitted a patch that allowed imread() to correctly read PNGs that have odd bit-depths, ie not 8 or 16 (I actually submitted that to the Users list as I was unsure of protocol). There were a couple of things I left unfinished that I've finally got round to looking