Skip to content

Commit

Permalink
Merge branch 'convert_to_png' into 'master'
Browse files Browse the repository at this point in the history
Convert tests images to png

Closes openpaperwork#15

See merge request World/OpenPaperwork/libpillowfight!14
  • Loading branch information
jflesch committed Aug 24, 2020
2 parents 4ccaad1 + ee2b4ca commit 35ecf0b
Show file tree
Hide file tree
Showing 64 changed files with 76 additions and 76 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down Expand Up @@ -156,16 +156,16 @@ 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

### Automatic Color Equalization (ACE)

| 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Binary file removed tests/data/black_border_problem.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem2.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem2_masks.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem2_masks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem3.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem3_border.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem3_border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem_all.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem_all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem_blackfilter.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem_blackfilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem_blurfilter.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem_blurfilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem_diff.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem_grayfilter.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem_grayfilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem_noisefilter.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem_noisefilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/black_border_problem_swt.jpg
Binary file not shown.
Binary file added tests/data/black_border_problem_swt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/data/brightness_problem.jpg
Binary file not shown.
Binary file added tests/data/brightness_problem.png
Binary file removed tests/data/brightness_problem_ace.jpg
Diff not rendered.
Binary file added tests/data/brightness_problem_ace.png
Binary file removed tests/data/brightness_problem_all.jpg
Diff not rendered.
Binary file added tests/data/brightness_problem_all.png
Binary file removed tests/data/brother_ds620.jpeg
Diff not rendered.
Binary file added tests/data/brother_ds620.png
Binary file removed tests/data/brother_mfc7360.jpeg
Diff not rendered.
Binary file added tests/data/brother_mfc7360.png
Binary file removed tests/data/crappy_background.jpg
Diff not rendered.
Binary file added tests/data/crappy_background.png
Binary file removed tests/data/crappy_background2.jpg
Diff not rendered.
Binary file added tests/data/crappy_background2.png
Binary file removed tests/data/crappy_background_canny.jpg
Diff not rendered.
Binary file added tests/data/crappy_background_canny.png
Binary file removed tests/data/crappy_background_gaussian.jpg
Diff not rendered.
Binary file added tests/data/crappy_background_gaussian.png
Binary file removed tests/data/crappy_background_sobel.jpg
Diff not rendered.
Binary file added tests/data/crappy_background_sobel.png
Binary file removed tests/data/crappy_background_swt.jpg
Diff not rendered.
Binary file added tests/data/crappy_background_swt.png
Binary file removed tests/data/epson_xp425.jpeg
Diff not rendered.
Binary file added tests/data/epson_xp425.png
6 changes: 3 additions & 3 deletions tests/tests_ace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
12 changes: 6 additions & 6 deletions tests/tests_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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()
6 changes: 3 additions & 3 deletions tests/tests_blackfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
6 changes: 3 additions & 3 deletions tests/tests_blurfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
6 changes: 3 additions & 3 deletions tests/tests_border.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
6 changes: 3 additions & 3 deletions tests/tests_canny.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
8 changes: 4 additions & 4 deletions tests/tests_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
6 changes: 3 additions & 3 deletions tests/tests_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
6 changes: 3 additions & 3 deletions tests/tests_grayfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
Loading

0 comments on commit 35ecf0b

Please sign in to comment.