diff --git a/PIL/PdfImagePlugin.py b/PIL/PdfImagePlugin.py index 725f22ecf..2a8a8d443 100644 --- a/PIL/PdfImagePlugin.py +++ b/PIL/PdfImagePlugin.py @@ -144,7 +144,7 @@ def _save(im, fp, filename): if bits == 1: # FIXME: the hex encoder doesn't support packed 1-bit # images; do things the hard way... - data = im.tostring("raw", "1") + data = im.tobytes("raw", "1") im = Image.new("L", (len(data), 1), None) im.putdata(data) ImageFile._save(im, op, [("hex", (0,0)+im.size, 0, im.mode)]) diff --git a/Tests/test_file_pdf.py b/Tests/test_file_pdf.py index 9a4faff3f..e31878aef 100644 --- a/Tests/test_file_pdf.py +++ b/Tests/test_file_pdf.py @@ -15,18 +15,12 @@ def helper_save_as_pdf(mode): assert_greater(os.path.getsize(outfile), 0) -# FIXME: 1-mode test "fails" because it produces a warning. -# https://travis-ci.org/hugovk/Pillow/builds/24916085 -# /home/travis/build/hugovk/Pillow/PIL/PdfImagePlugin.py:147: -# DeprecationWarning: tostring() is deprecated. Please call tobytes() instead. -# data = im.tostring("raw", "1") -# -# def test_monochrome(): -# # Arrange -# mode = "1" -# -# # Act / Assert -# helper_save_as_pdf(mode) +def test_monochrome(): + # Arrange + mode = "1" + + # Act / Assert + helper_save_as_pdf(mode) def test_greyscale():