test_load_img.py 566 B

12345678910111213141516171819
  1. from sorawm.iopaint.helper import load_img
  2. from sorawm.iopaint.tests.utils import current_dir
  3. png_img_p = current_dir / "image.png"
  4. jpg_img_p = current_dir / "bunny.jpeg"
  5. def test_load_png_image():
  6. with open(png_img_p, "rb") as f:
  7. np_img, alpha_channel = load_img(f.read())
  8. assert np_img.shape == (256, 256, 3)
  9. assert alpha_channel.shape == (256, 256)
  10. def test_load_jpg_image():
  11. with open(jpg_img_p, "rb") as f:
  12. np_img, alpha_channel = load_img(f.read())
  13. assert np_img.shape == (394, 448, 3)
  14. assert alpha_channel is None