mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-14 19:36:38 +03:00
Merge pull request #2805 from ixio/fix-#2804
Fix #2804: sets encoderinfo for images when saving multi-page PDF
This commit is contained in:
commit
52079cb297
|
@ -139,7 +139,7 @@ def _save(im, fp, filename, save_all=False):
|
||||||
for append_im in append_images:
|
for append_im in append_images:
|
||||||
if append_im.mode != im.mode:
|
if append_im.mode != im.mode:
|
||||||
append_im = append_im.convert(im.mode)
|
append_im = append_im.convert(im.mode)
|
||||||
append_im.encoderinfo = im.encoderinfo.copy()
|
append_im.encoderinfo = im.encoderinfo.copy()
|
||||||
ims.append(append_im)
|
ims.append(append_im)
|
||||||
numberOfPages = 0
|
numberOfPages = 0
|
||||||
for im in ims:
|
for im in ims:
|
||||||
|
|
|
@ -90,6 +90,13 @@ class TestFilePdf(PillowTestCase):
|
||||||
self.assertTrue(os.path.isfile(outfile))
|
self.assertTrue(os.path.isfile(outfile))
|
||||||
self.assertGreater(os.path.getsize(outfile), 0)
|
self.assertGreater(os.path.getsize(outfile), 0)
|
||||||
|
|
||||||
|
# Append JPEG images
|
||||||
|
jpeg = Image.open("Tests/images/flower.jpg")
|
||||||
|
jpeg.save(outfile, save_all=True, append_images=[jpeg.copy()])
|
||||||
|
|
||||||
|
self.assertTrue(os.path.isfile(outfile))
|
||||||
|
self.assertGreater(os.path.getsize(outfile), 0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user