imageio / imageio-binaries

Repo to place the (relatively small) binary libraries
144 stars 139 forks source link

added test images #16

Closed FirefoxMetzger closed 3 years ago

FirefoxMetzger commented 3 years ago

While writing tests for https://github.com/imageio/imageio/pull/574 I realized that it will be good to have a single image in several formats, so that we can test reading/writing individually while having meaningful targets to compare to. This PR essentially proposes that.

I chose to make it separate from the main images folder, because - in my understanding - the images folder provides a collection of standard images. Not sure if we need/want to provide certain standard images in several formats; we do want this for testing though. Hence this is two folders, but it could also be merged into a single one.

almarklein commented 3 years ago

On the one hand it makes sense to put test images in another folder, on the other, being able to load a test image via imageio.imread("imageio:some_test_image.whatever") is also nice to be able to reproduce stuff quickly etc.

What about adding a prefix to the test images?

FirefoxMetzger commented 3 years ago

We can also add them to the images folder and prefix them with "test_", if you don't think it will pollute the directory too much. I'm happy for you to make the final judgment call here.

My thought on keeping it separate is that we can add a "download_all_standard_images" function that will essentially just download all the images from the images folder without tracking what is a test image and what is a standard image. I'm not sure about the utility of downloading variations of chelsea in all the different formats for anything but testing an I/O library.

When testing, I'm not going to load the images via imageio:some_test_image.format, because I'm trying to write tests that don't rely on parts of the library itself for setup. This way, if something breaks for reading standard images via imageio:... we won't have 200+ tests failing at the same time.

almarklein commented 3 years ago

... because I'm trying to write tests that don't rely on parts of the library itself for setup

True ...

My thought on keeping it separate is that we can add a "download_all_standard_images" function that will essentially just download all the images from the images folder

Well, we already have this: https://github.com/imageio/imageio/blob/master/imageio/core/request.py#L36

Ok, I guess it does not matter either way. Let's roll with what you're proposing here, and keep the directories clean and separated :)

Feel free to merge 👍

FirefoxMetzger commented 3 years ago

Well, we already have this

I assumed it was probably somewhere ... I didn't manage to figure it out by skim-reading the sourcecode though; thanks for the link.

I'll leave this PR open for now, as I'm still porting tests for pillow and might end up adding more images here. once they are all done, I'll ping you here again and then we can proceed with the merge.