mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-24 22:24:48 +03:00
Show error for negative PDF res.
This commit is contained in:
parent
eacdb3d843
commit
aba3e62968
|
@ -67,6 +67,7 @@ class TestFilePdf(PillowTestCase):
|
|||
def test_resolution(self):
|
||||
self.helper_save_as_pdf("RGB", resolution=300.5)
|
||||
self.helper_save_as_pdf("RGB", resolution=(300, 150))
|
||||
self.assertRaises(ValueError, self.helper_save_as_pdf, "RGB", resolution=-100)
|
||||
|
||||
def test_unsupported_mode(self):
|
||||
im = hopper("LA")
|
||||
|
|
|
@ -63,6 +63,8 @@ def _save(im, fp, filename, save_all=False):
|
|||
else:
|
||||
pdf_width_res = resolution[0]
|
||||
pdf_height_res = resolution[1]
|
||||
if pdf_width_res <= 0 or pdf_height_res <= 0:
|
||||
raise ValueError("Resolution must be > 0")
|
||||
|
||||
info = {
|
||||
"title": None if is_appending else os.path.splitext(
|
||||
|
|
Loading…
Reference in New Issue
Block a user