diff --git a/README.md b/README.md index 95119e8..751fec5 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Example: ```py import pillowfight -input_img = PIL.Image.open("tests/data/brightness_problem.jpg") +input_img = PIL.Image.open("tests/data/brightness_problem.png") output_img = pillowfight.ace(input_img) ``` @@ -156,8 +156,8 @@ A basic documentation for some of the algorithms can be found in | Input | Output | | ----- | ------ | -| [Black border problem](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem.jpg) | [ACE + Unpapered](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_all.jpg) | -| [Brightness problem](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/brightness_problem.jpg) | [ACE + Unpapered](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/brightness_problem_all.jpg) | +| [Black border problem](tests/data/black_border_problem.png) | [ACE + Unpapered](tests/data/black_border_problem_all.png) | +| [Brightness problem](tests/data/brightness_problem.png) | [ACE + Unpapered](tests/data/brightness_problem_all.png) | ## Available algorithms @@ -165,7 +165,7 @@ A basic documentation for some of the algorithms can be found in | Input | Output | | ----- | ------ | -| [Brightness problem](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/brightness_problem.jpg) | [Corrected](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/brightness_problem_ace.jpg) | +| [Brightness problem](tests/data/brightness_problem.png) | [Corrected](tests/data/brightness_problem_ace.png) | This algorithm is quite slow (~40s for one big image with one thread on my machine). So this version is parallelized (down to ~15s on a 4 @@ -235,9 +235,9 @@ cropping area. | Input | Output | | ----- | ------ | -| [brother_mfc7360n](https://gitlab.gnome.org/World/OpenPaperwork/libpillowfight/raw/master/tests/data/brother_mfc7360.jpeg) | (56, 8, 1637, 2275) | -| [epson_xp425](https://gitlab.gnome.org/World/OpenPaperwork/libpillowfight/raw/master/tests/data/epson_xp425) | (4, 5, 2484, 3498) | -| [brother_ds620](https://gitlab.gnome.org/World/OpenPaperwork/libpillowfight/raw/master/tests/data/brother_ds620.jpeg) | (3, 3, 2507, 3527) | +| [brother_mfc7360n](tests/data/brother_mfc7360.png) | (56, 8, 1637, 2275) | +| [epson_xp425](tests/data/epson_xp425.png) | (4, 5, 2484, 3498) | +| [brother_ds620](tests/data/brother_ds620.png) | (3, 3, 2507, 3527) | #### Python API @@ -272,7 +272,7 @@ struct pf_rectangle pf_find_scan_borders(const struct pf_bitmap *img_in); | Input | Output | | ----- | ------ | -| [Crappy background](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background.jpg) | [Canny output](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background_canny.jpg) | +| [Crappy background](tests/data/crappy_background.png) | [Canny output](tests/data/crappy_background_canny.png) | #### Python API @@ -307,7 +307,7 @@ are considered equal). | Input | Input2 | Output | | ----- | ------ | ------ | -| [Black border problem](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem.jpg) | [Black border problem + blackfilter](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_blackfilter.jpg) | [Diff](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_diff.jpg) | +| [Black border problem](tests/data/black_border_problem.png) | [Black border problem + blackfilter](tests/data/black_border_problem_blackfilter.png) | [Diff](tests/data/black_border_problem_diff.png) | #### Python API @@ -330,7 +330,7 @@ Returns the number of pixels that are different between both images. | Input | Output | | ----- | ------ | -| [Crappy background](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background.jpg) | [Gaussed](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background_gaussian.jpg) | +| [Crappy background](tests/data/crappy_background.png) | [Gaussed](tests/data/crappy_background_gaussian.png) | One of the parameters is ```sigma```. If it is equals to 0.0, it will be computed automatically using the following formula (same as OpenCV): @@ -364,7 +364,7 @@ extern void pf_gaussian(const struct pf_bitmap *in, struct pf_bitmap *out, | Input | Output | | ----- | ------ | -| [Crappy background](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background.jpg) | [Sobel](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background_sobel.jpg) | +| [Crappy background](tests/data/crappy_background.png) | [Sobel](tests/data/crappy_background_sobel.png) | #### Python API @@ -404,10 +404,10 @@ This implementation can provide the output in 3 different ways: | Input | Output | | ----- | ------ | -| [Black border problen](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem.jpg) | [SWT (SWT_OUTPUT_ORIGINAL_BOXES)](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_swt.jpg) | -| [Crappy background](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background.jpg) | [SWT (SWT_OUTPUT_ORIGINAL_BOXES)](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/crappy_background_swt.jpg) | -| [Black border problen](https://raw.githubusercontent.com/openpaperwork/libpillowfight/47b1f59ce9a5fb3816e3abd186c28cc4c6092e13/tests/data/black_border_problem.jpg) | [SWT (SWT_OUTPUT_BW_TEXT)](https://raw.githubusercontent.com/openpaperwork/libpillowfight/47b1f59ce9a5fb3816e3abd186c28cc4c6092e13/tests/data/black_border_problem_swt.jpg) | -| [Crappy background](https://raw.githubusercontent.com/openpaperwork/libpillowfight/47b1f59ce9a5fb3816e3abd186c28cc4c6092e13/tests/data/crappy_background.jpg) | [SWT (SWT_OUTPUT_BW_TEXT)](https://raw.githubusercontent.com/openpaperwork/libpillowfight/47b1f59ce9a5fb3816e3abd186c28cc4c6092e13/tests/data/crappy_background_swt.jpg) | +| [Black border problen](tests/data/black_border_problem.png) | [SWT (SWT_OUTPUT_ORIGINAL_BOXES)](tests/data/black_border_problem_swt.png) | +| [Crappy background](tests/data/crappy_background.png) | [SWT (SWT_OUTPUT_ORIGINAL_BOXES)](tests/data/crappy_background_swt.png) | +| [Black border problen](tests/data/black_border_problem.png) | [SWT (SWT_OUTPUT_BW_TEXT)](tests/data/black_border_problem_swt.png) | +| [Crappy background](tests/data/crappy_background.png) | [SWT (SWT_OUTPUT_BW_TEXT)](tests/data/crappy_background_swt.png) | #### Python API @@ -447,7 +447,7 @@ extern void pf_swt(const struct pf_bitmap *in_img, struct pf_bitmap *out_img, | Input | Output | Diff | | ----- | ------ | ---- | -| [Black border problem](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem.jpg) | [Filtered](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_blackfilter.jpg) | [Diff](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_blackfilter_diff.jpg) | +| [Black border problem](tests/data/black_border_problem.png) | [Filtered](tests/data/black_border_problem_blackfilter.png) | [Diff](tests/data/black_border_problem_blackfilter_diff.png) | #### Python API @@ -474,7 +474,7 @@ extern void pf_unpaper_blackfilter(const struct pf_bitmap *in, struct pf_bitmap | Input | Output | Diff | | ----- | ------ | ---- | -| [Black border problem](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem.jpg) | [Filtered](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_blurfilter.jpg) | [Diff](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_blurfilter_diff.jpg) | +| [Black border problem](tests/data/black_border_problem.png) | [Filtered](tests/data/black_border_problem_blurfilter.png) | [Diff](tests/data/black_border_problem_blurfilter_diff.png) | #### Python API @@ -501,7 +501,7 @@ extern void pf_unpaper_blurfilter(const struct pf_bitmap *in, struct pf_bitmap * | Input | Output | Diff | | ----- | ------ | ---- | -| [Black border problem 3](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem3.jpg) | [Border](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem3_border.jpg) | [Diff](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem3_border_diff.jpg) | +| [Black border problem 3](tests/data/black_border_problem3.png) | [Border](tests/data/black_border_problem3_border.png) | [Diff](tests/data/black_border_problem3_border_diff.png) | #### Python API @@ -528,7 +528,7 @@ extern void pf_unpaper_border(const struct pf_bitmap *in, struct pf_bitmap *out) | Input | Output | Diff | | ----- | ------ | ---- | -| [Black border problem 3](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem.jpg) | [Filterd](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_grayfilter.jpg) | [Diff](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_grayfilter_diff.jpg) | +| [Black border problem 3](tests/data/black_border_problem.png) | [Filterd](tests/data/black_border_problem_grayfilter.png) | [Diff](tests/data/black_border_problem_grayfilter_diff.png) | #### Python API @@ -555,7 +555,7 @@ extern void pf_unpaper_grayfilter(const struct pf_bitmap *in, struct pf_bitmap * | Input | Output | Diff | | ----- | ------ | ---- | -| [Black border problem 2](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem2.jpg) | [Masks](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem2_masks.jpg) | [Diff](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem2_masks_diff.jpg) | +| [Black border problem 2](tests/data/black_border_problem2.png) | [Masks](tests/data/black_border_problem2_masks.png) | [Diff](tests/data/black_border_problem2_masks_diff.png) | #### Python API @@ -582,7 +582,7 @@ extern void pf_unpaper_masks(const struct pf_bitmap *in, struct pf_bitmap *out); | Input | Output | Diff | | ----- | ------ | ---- | -| [Black border problem](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem.jpg) | [Filtered](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_noisefilter.jpg) | [Diff](https://raw.githubusercontent.com/openpaperwork/libpillowfight/master/tests/data/black_border_problem_noisefilter_diff.jpg) | +| [Black border problem](tests/data/black_border_problem.png) | [Filtered](tests/data/black_border_problem_noisefilter.png) | [Diff](tests/data/black_border_problem_noisefilter_diff.png) | #### Python API diff --git a/tests/data/black_border_problem.jpg b/tests/data/black_border_problem.jpg deleted file mode 100644 index 6af4e80..0000000 Binary files a/tests/data/black_border_problem.jpg and /dev/null differ diff --git a/tests/data/black_border_problem.png b/tests/data/black_border_problem.png new file mode 100644 index 0000000..7e9340f Binary files /dev/null and b/tests/data/black_border_problem.png differ diff --git a/tests/data/black_border_problem2.jpg b/tests/data/black_border_problem2.jpg deleted file mode 100644 index 843aa29..0000000 Binary files a/tests/data/black_border_problem2.jpg and /dev/null differ diff --git a/tests/data/black_border_problem2.png b/tests/data/black_border_problem2.png new file mode 100644 index 0000000..cb9b709 Binary files /dev/null and b/tests/data/black_border_problem2.png differ diff --git a/tests/data/black_border_problem2_masks.jpg b/tests/data/black_border_problem2_masks.jpg deleted file mode 100644 index 62bd0c6..0000000 Binary files a/tests/data/black_border_problem2_masks.jpg and /dev/null differ diff --git a/tests/data/black_border_problem2_masks.png b/tests/data/black_border_problem2_masks.png new file mode 100644 index 0000000..dee3f1d Binary files /dev/null and b/tests/data/black_border_problem2_masks.png differ diff --git a/tests/data/black_border_problem3.jpg b/tests/data/black_border_problem3.jpg deleted file mode 100644 index 3d202b6..0000000 Binary files a/tests/data/black_border_problem3.jpg and /dev/null differ diff --git a/tests/data/black_border_problem3.png b/tests/data/black_border_problem3.png new file mode 100644 index 0000000..f1ea3e0 Binary files /dev/null and b/tests/data/black_border_problem3.png differ diff --git a/tests/data/black_border_problem3_border.jpg b/tests/data/black_border_problem3_border.jpg deleted file mode 100644 index cb334f3..0000000 Binary files a/tests/data/black_border_problem3_border.jpg and /dev/null differ diff --git a/tests/data/black_border_problem3_border.png b/tests/data/black_border_problem3_border.png new file mode 100644 index 0000000..3f755c6 Binary files /dev/null and b/tests/data/black_border_problem3_border.png differ diff --git a/tests/data/black_border_problem_all.jpg b/tests/data/black_border_problem_all.jpg deleted file mode 100644 index 37c0932..0000000 Binary files a/tests/data/black_border_problem_all.jpg and /dev/null differ diff --git a/tests/data/black_border_problem_all.png b/tests/data/black_border_problem_all.png new file mode 100644 index 0000000..7cf266b Binary files /dev/null and b/tests/data/black_border_problem_all.png differ diff --git a/tests/data/black_border_problem_blackfilter.jpg b/tests/data/black_border_problem_blackfilter.jpg deleted file mode 100644 index ede6cf2..0000000 Binary files a/tests/data/black_border_problem_blackfilter.jpg and /dev/null differ diff --git a/tests/data/black_border_problem_blackfilter.png b/tests/data/black_border_problem_blackfilter.png new file mode 100644 index 0000000..c58657e Binary files /dev/null and b/tests/data/black_border_problem_blackfilter.png differ diff --git a/tests/data/black_border_problem_blurfilter.jpg b/tests/data/black_border_problem_blurfilter.jpg deleted file mode 100644 index 114d40f..0000000 Binary files a/tests/data/black_border_problem_blurfilter.jpg and /dev/null differ diff --git a/tests/data/black_border_problem_blurfilter.png b/tests/data/black_border_problem_blurfilter.png new file mode 100644 index 0000000..f581b5e Binary files /dev/null and b/tests/data/black_border_problem_blurfilter.png differ diff --git a/tests/data/black_border_problem_diff.jpg b/tests/data/black_border_problem_diff.jpg deleted file mode 100644 index d6ed709..0000000 Binary files a/tests/data/black_border_problem_diff.jpg and /dev/null differ diff --git a/tests/data/black_border_problem_diff.png b/tests/data/black_border_problem_diff.png new file mode 100644 index 0000000..ca112a7 Binary files /dev/null and b/tests/data/black_border_problem_diff.png differ diff --git a/tests/data/black_border_problem_grayfilter.jpg b/tests/data/black_border_problem_grayfilter.jpg deleted file mode 100644 index ac8c81c..0000000 Binary files a/tests/data/black_border_problem_grayfilter.jpg and /dev/null differ diff --git a/tests/data/black_border_problem_grayfilter.png b/tests/data/black_border_problem_grayfilter.png new file mode 100644 index 0000000..11029cd Binary files /dev/null and b/tests/data/black_border_problem_grayfilter.png differ diff --git a/tests/data/black_border_problem_noisefilter.jpg b/tests/data/black_border_problem_noisefilter.jpg deleted file mode 100644 index bde4a6b..0000000 Binary files a/tests/data/black_border_problem_noisefilter.jpg and /dev/null differ diff --git a/tests/data/black_border_problem_noisefilter.png b/tests/data/black_border_problem_noisefilter.png new file mode 100644 index 0000000..d94d64f Binary files /dev/null and b/tests/data/black_border_problem_noisefilter.png differ diff --git a/tests/data/black_border_problem_swt.jpg b/tests/data/black_border_problem_swt.jpg deleted file mode 100644 index 1e869ab..0000000 Binary files a/tests/data/black_border_problem_swt.jpg and /dev/null differ diff --git a/tests/data/black_border_problem_swt.png b/tests/data/black_border_problem_swt.png new file mode 100644 index 0000000..b0ed76c Binary files /dev/null and b/tests/data/black_border_problem_swt.png differ diff --git a/tests/data/brightness_problem.jpg b/tests/data/brightness_problem.jpg deleted file mode 100644 index 38adf05..0000000 Binary files a/tests/data/brightness_problem.jpg and /dev/null differ diff --git a/tests/data/brightness_problem.png b/tests/data/brightness_problem.png new file mode 100644 index 0000000..969ca9c Binary files /dev/null and b/tests/data/brightness_problem.png differ diff --git a/tests/data/brightness_problem_ace.jpg b/tests/data/brightness_problem_ace.jpg deleted file mode 100644 index 4aca30a..0000000 Binary files a/tests/data/brightness_problem_ace.jpg and /dev/null differ diff --git a/tests/data/brightness_problem_ace.png b/tests/data/brightness_problem_ace.png new file mode 100644 index 0000000..323beb5 Binary files /dev/null and b/tests/data/brightness_problem_ace.png differ diff --git a/tests/data/brightness_problem_all.jpg b/tests/data/brightness_problem_all.jpg deleted file mode 100644 index 42720bb..0000000 Binary files a/tests/data/brightness_problem_all.jpg and /dev/null differ diff --git a/tests/data/brightness_problem_all.png b/tests/data/brightness_problem_all.png new file mode 100644 index 0000000..bee81e3 Binary files /dev/null and b/tests/data/brightness_problem_all.png differ diff --git a/tests/data/brother_ds620.jpeg b/tests/data/brother_ds620.jpeg deleted file mode 100644 index deb80c7..0000000 Binary files a/tests/data/brother_ds620.jpeg and /dev/null differ diff --git a/tests/data/brother_ds620.png b/tests/data/brother_ds620.png new file mode 100644 index 0000000..c84a534 Binary files /dev/null and b/tests/data/brother_ds620.png differ diff --git a/tests/data/brother_mfc7360.jpeg b/tests/data/brother_mfc7360.jpeg deleted file mode 100644 index 1595000..0000000 Binary files a/tests/data/brother_mfc7360.jpeg and /dev/null differ diff --git a/tests/data/brother_mfc7360.png b/tests/data/brother_mfc7360.png new file mode 100644 index 0000000..51be055 Binary files /dev/null and b/tests/data/brother_mfc7360.png differ diff --git a/tests/data/crappy_background.jpg b/tests/data/crappy_background.jpg deleted file mode 100644 index d07d81a..0000000 Binary files a/tests/data/crappy_background.jpg and /dev/null differ diff --git a/tests/data/crappy_background.png b/tests/data/crappy_background.png new file mode 100644 index 0000000..e28fb10 Binary files /dev/null and b/tests/data/crappy_background.png differ diff --git a/tests/data/crappy_background2.jpg b/tests/data/crappy_background2.jpg deleted file mode 100644 index 5099482..0000000 Binary files a/tests/data/crappy_background2.jpg and /dev/null differ diff --git a/tests/data/crappy_background2.png b/tests/data/crappy_background2.png new file mode 100644 index 0000000..7383798 Binary files /dev/null and b/tests/data/crappy_background2.png differ diff --git a/tests/data/crappy_background_canny.jpg b/tests/data/crappy_background_canny.jpg deleted file mode 100644 index ed2030a..0000000 Binary files a/tests/data/crappy_background_canny.jpg and /dev/null differ diff --git a/tests/data/crappy_background_canny.png b/tests/data/crappy_background_canny.png new file mode 100644 index 0000000..61cf055 Binary files /dev/null and b/tests/data/crappy_background_canny.png differ diff --git a/tests/data/crappy_background_gaussian.jpg b/tests/data/crappy_background_gaussian.jpg deleted file mode 100644 index eeaed9f..0000000 Binary files a/tests/data/crappy_background_gaussian.jpg and /dev/null differ diff --git a/tests/data/crappy_background_gaussian.png b/tests/data/crappy_background_gaussian.png new file mode 100644 index 0000000..cd4aa22 Binary files /dev/null and b/tests/data/crappy_background_gaussian.png differ diff --git a/tests/data/crappy_background_sobel.jpg b/tests/data/crappy_background_sobel.jpg deleted file mode 100644 index 71b4026..0000000 Binary files a/tests/data/crappy_background_sobel.jpg and /dev/null differ diff --git a/tests/data/crappy_background_sobel.png b/tests/data/crappy_background_sobel.png new file mode 100644 index 0000000..a9629f8 Binary files /dev/null and b/tests/data/crappy_background_sobel.png differ diff --git a/tests/data/crappy_background_swt.jpg b/tests/data/crappy_background_swt.jpg deleted file mode 100644 index 740f3dd..0000000 Binary files a/tests/data/crappy_background_swt.jpg and /dev/null differ diff --git a/tests/data/crappy_background_swt.png b/tests/data/crappy_background_swt.png new file mode 100644 index 0000000..9fb475c Binary files /dev/null and b/tests/data/crappy_background_swt.png differ diff --git a/tests/data/epson_xp425.jpeg b/tests/data/epson_xp425.jpeg deleted file mode 100644 index 570f5b2..0000000 Binary files a/tests/data/epson_xp425.jpeg and /dev/null differ diff --git a/tests/data/epson_xp425.png b/tests/data/epson_xp425.png new file mode 100644 index 0000000..8adda1d Binary files /dev/null and b/tests/data/epson_xp425.png differ diff --git a/tests/tests_ace.py b/tests/tests_ace.py index 689e49b..76098b4 100644 --- a/tests/tests_ace.py +++ b/tests/tests_ace.py @@ -8,8 +8,8 @@ class TestACE(unittest.TestCase): def test_ace(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/brightness_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/brightness_problem.png") out_img = pillowfight.ace(in_img, seed=12345) in_img.close() @@ -20,7 +20,7 @@ def test_ace(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/brightness_problem_ace.jpg" + "tests/data/brightness_problem_ace.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_all.py b/tests/tests_all.py index 320f74d..0235848 100644 --- a/tests/tests_all.py +++ b/tests/tests_all.py @@ -8,8 +8,8 @@ class TestAll(unittest.TestCase): def test_all_1(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem.png") out_img = pillowfight.ace(in_img, seed=0xDEADBEE) @@ -30,14 +30,14 @@ def test_all_1(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem_all.jpg" + "tests/data/black_border_problem_all.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() def test_all_2(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/brightness_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/brightness_problem.png") out_img = pillowfight.ace(in_img, seed=0xBEEDEAD) @@ -58,7 +58,7 @@ def test_all_2(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/brightness_problem_all.jpg" + "tests/data/brightness_problem_all.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_blackfilter.py b/tests/tests_blackfilter.py index 41d582c..20f018c 100644 --- a/tests/tests_blackfilter.py +++ b/tests/tests_blackfilter.py @@ -8,8 +8,8 @@ class TestBlackfilter(unittest.TestCase): def test_blackfilter(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem.png") out_img = pillowfight.unpaper_blackfilter(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_blackfilter(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem_blackfilter.jpg" + "tests/data/black_border_problem_blackfilter.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_blurfilter.py b/tests/tests_blurfilter.py index 6d689f1..3ca7b99 100644 --- a/tests/tests_blurfilter.py +++ b/tests/tests_blurfilter.py @@ -8,8 +8,8 @@ class TestBlurfilter(unittest.TestCase): def test_blurfilter(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem.png") out_img = pillowfight.unpaper_blurfilter(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_blurfilter(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem_blurfilter.jpg" + "tests/data/black_border_problem_blurfilter.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_border.py b/tests/tests_border.py index ecc36ec..aab573b 100644 --- a/tests/tests_border.py +++ b/tests/tests_border.py @@ -8,8 +8,8 @@ class TestBorder(unittest.TestCase): def test_border(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem3.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem3.png") out_img = pillowfight.unpaper_border(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_border(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem3_border.jpg" + "tests/data/black_border_problem3_border.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_canny.py b/tests/tests_canny.py index ba216b7..6882543 100644 --- a/tests/tests_canny.py +++ b/tests/tests_canny.py @@ -8,8 +8,8 @@ class TestCanny(unittest.TestCase): def test_canny(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/crappy_background.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/crappy_background.png") out_img = pillowfight.canny(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_canny(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/crappy_background_canny.jpg" + "tests/data/crappy_background_canny.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_compare.py b/tests/tests_compare.py index 385d3f0..9baf839 100644 --- a/tests/tests_compare.py +++ b/tests/tests_compare.py @@ -8,10 +8,10 @@ class TestCompare(unittest.TestCase): def test_compare(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem.png") in_img2 = PIL.Image.open( - "tests/data/black_border_problem_blackfilter.jpg" + "tests/data/black_border_problem_blackfilter.png" ) (has_diff, out_img) = pillowfight.compare(in_img, in_img2) @@ -26,7 +26,7 @@ def test_compare(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem_diff.jpg" + "tests/data/black_border_problem_diff.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_gaussian.py b/tests/tests_gaussian.py index a56364c..68ac0e1 100644 --- a/tests/tests_gaussian.py +++ b/tests/tests_gaussian.py @@ -8,8 +8,8 @@ class TestGaussian(unittest.TestCase): def test_gaussian(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/crappy_background.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/crappy_background.png") out_img = pillowfight.gaussian(in_img, sigma=20.0, nb_stddev=10) in_img.close() @@ -20,7 +20,7 @@ def test_gaussian(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/crappy_background_gaussian.jpg" + "tests/data/crappy_background_gaussian.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_grayfilter.py b/tests/tests_grayfilter.py index 20be0b2..7e7fc4d 100644 --- a/tests/tests_grayfilter.py +++ b/tests/tests_grayfilter.py @@ -8,8 +8,8 @@ class TestGrayFilter(unittest.TestCase): def test_grayfilter(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem.png") out_img = pillowfight.unpaper_grayfilter(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_grayfilter(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem_grayfilter.jpg" + "tests/data/black_border_problem_grayfilter.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_masks.py b/tests/tests_masks.py index f67d36f..d941173 100644 --- a/tests/tests_masks.py +++ b/tests/tests_masks.py @@ -8,8 +8,8 @@ class TestMasks(unittest.TestCase): def test_masks(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem2.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem2.png") out_img = pillowfight.unpaper_masks(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_masks(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem2_masks.jpg" + "tests/data/black_border_problem2_masks.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_noisefilter.py b/tests/tests_noisefilter.py index 7d7936c..a84498b 100644 --- a/tests/tests_noisefilter.py +++ b/tests/tests_noisefilter.py @@ -8,8 +8,8 @@ class TestNoisefilter(unittest.TestCase): def test_noisefilter(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem.png") out_img = pillowfight.unpaper_noisefilter(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_noisefilter(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem_noisefilter.jpg" + "tests/data/black_border_problem_noisefilter.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_scan_borders.py b/tests/tests_scan_borders.py index 474ef12..1953364 100644 --- a/tests/tests_scan_borders.py +++ b/tests/tests_scan_borders.py @@ -8,16 +8,16 @@ class TestScanBorders(unittest.TestCase): def test_scan_borders_a(self): - in_img = PIL.Image.open("tests/data/brother_mfc7360.jpeg") + in_img = PIL.Image.open("tests/data/brother_mfc7360.png") frame = pillowfight.find_scan_borders(in_img) self.assertEqual(frame, (8, 37, 1637, 2195)) def test_scan_borders_b(self): - in_img = PIL.Image.open("tests/data/epson_xp425.jpeg") + in_img = PIL.Image.open("tests/data/epson_xp425.png") frame = pillowfight.find_scan_borders(in_img) self.assertEqual(frame, (11, 4, 2541, 3503)) def test_scan_borders_c(self): - in_img = PIL.Image.open("tests/data/brother_ds620.jpeg") + in_img = PIL.Image.open("tests/data/brother_ds620.png") frame = pillowfight.find_scan_borders(in_img) self.assertEqual(frame, (3, 3, 2507, 3527)) diff --git a/tests/tests_sobel.py b/tests/tests_sobel.py index 6b74e88..ecff35b 100644 --- a/tests/tests_sobel.py +++ b/tests/tests_sobel.py @@ -8,8 +8,8 @@ class TestSobel(unittest.TestCase): def test_sobel(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/crappy_background.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/crappy_background.png") out_img = pillowfight.sobel(in_img) in_img.close() @@ -20,7 +20,7 @@ def test_sobel(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/crappy_background_sobel.jpg" + "tests/data/crappy_background_sobel.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/tests/tests_swt.py b/tests/tests_swt.py index 142e81b..acb6a4e 100644 --- a/tests/tests_swt.py +++ b/tests/tests_swt.py @@ -8,8 +8,8 @@ class TestSWT(unittest.TestCase): def test_swt(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/crappy_background.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/crappy_background.png") out_img = pillowfight.swt( in_img, output_type=pillowfight.SWT_OUTPUT_ORIGINAL_BOXES ) @@ -22,14 +22,14 @@ def test_swt(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/crappy_background_swt.jpg" + "tests/data/crappy_background_swt.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() def test_swt2(self): - with tempfile.NamedTemporaryFile(suffix='.jpg') as tmpfile: - in_img = PIL.Image.open("tests/data/black_border_problem.jpg") + with tempfile.NamedTemporaryFile(suffix='.png') as tmpfile: + in_img = PIL.Image.open("tests/data/black_border_problem.png") out_img = pillowfight.swt( in_img, output_type=pillowfight.SWT_OUTPUT_ORIGINAL_BOXES ) @@ -42,7 +42,7 @@ def test_swt2(self): out_img = PIL.Image.open(tmpfile.name) expected_img = PIL.Image.open( - "tests/data/black_border_problem_swt.jpg" + "tests/data/black_border_problem_swt.png" ) self.assertEqual(out_img.tobytes(), expected_img.tobytes()) expected_img.close() diff --git a/upd_diffs.sh b/upd_diffs.sh index ad1a6ad..e4f8b63 100755 --- a/upd_diffs.sh +++ b/upd_diffs.sh @@ -1,9 +1,9 @@ #!/bin/bash cd tests/data -gm compare black_border_problem.jpg black_border_problem_blackfilter.jpg -file black_border_problem_blackfilter_diff.jpg -gm compare black_border_problem.jpg black_border_problem_blurfilter.jpg -file black_border_problem_blurfilter_diff.jpg -gm compare black_border_problem3.jpg black_border_problem3_border.jpg -file black_border_problem3_border_diff.jpg -gm compare black_border_problem.jpg black_border_problem_grayfilter.jpg -file black_border_problem_grayfilter_diff.jpg -gm compare black_border_problem2.jpg black_border_problem2_masks.jpg -file black_border_problem2_masks_diff.jpg -gm compare black_border_problem.jpg black_border_problem_noisefilter.jpg -file black_border_problem_noisefilter_diff.jpg +gm compare black_border_problem.png black_border_problem_blackfilter.png -file black_border_problem_blackfilter_diff.png +gm compare black_border_problem.png black_border_problem_blurfilter.png -file black_border_problem_blurfilter_diff.png +gm compare black_border_problem3.png black_border_problem3_border.png -file black_border_problem3_border_diff.png +gm compare black_border_problem.png black_border_problem_grayfilter.png -file black_border_problem_grayfilter_diff.png +gm compare black_border_problem2.png black_border_problem2_masks.png -file black_border_problem2_masks_diff.png +gm compare black_border_problem.png black_border_problem_noisefilter.png -file black_border_problem_noisefilter_diff.png