Skip to content

Commit

Permalink
Merge pull request #2805 from ixio/fix-#2804
Browse files Browse the repository at this point in the history
Fix #2804: sets encoderinfo for images when saving multi-page PDF
  • Loading branch information
wiredfool committed Nov 5, 2017
2 parents 5957d61 + 5dfe5f0 commit 52079cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PIL/PdfImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def write(self, value):
for append_im in append_images:
if append_im.mode != 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)
numberOfPages = 0
for im in ims:
Expand Down
7 changes: 7 additions & 0 deletions Tests/test_file_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def imGenerator(ims):
self.assertTrue(os.path.isfile(outfile))
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__':
unittest.main()

0 comments on commit 52079cb

Please sign in to comment.