Hi Tony,
Hi Ralf,Thanks for the feedback.I couldn't easily find any palette images that weren't copyrighted; it never occurred to me just create them. Thanks.On Oct 30, 2009, at 11:31 AM, Ralf Gommers wrote:The images on the page you linked to can not be included I think (copyright), so could you generate two small palette images (one rgb, one grey, 10x10 pixels) for use in a test? (or ideally, write the test:))
Also, I see you are already using git, so next time could you push your changes to github as described here http://stefanv.github.com/scikits.image/contribute.html#development-process, that would make it a bit faster to test.
I was afraid I'd have to learn git. ;)
I added the changes in three commits to: http://github.com/tonysyu/scikits.imageThe first commit just adds the images, the second adds palette image handling + a test, and the third adds an additional test.I wasn't sure how to test imread. I ended up checking that imread returns a 2D array for the grayscale palette image and a 3D array for the color palette image. Another possibility is to test the values of the array, but that seems fragile.
The last commit adds a test of the function `palette_is_gray`. Unfortunately, the test is a bit ugly. First, I had to add an import of PIL in the test, since palette_is_gray works specifically on PIL palette images. Second, I had to add `palette_is_grayscale` to __all__ in pil_imread so that I could use the function in my test. (Python documentation suggests that __all__ only affects ``from <> import *``, but it seemed to prevent ``from scikits.image.io import palette_is_grayscale``.)
Let me know what you think of the tests. Also, should I do a pull request?