From 3fb492f3026ded43b6718d71460d05a490c9a387 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 11 May 2022 11:16:10 +0200 Subject: [PATCH] Assume pillow is always available Also read https://groups.google.com/g/reportlab-users/c/ipYLOar7KcI --- svglib/svglib.py | 7 ------- tests/test_samples.py | 2 -- 2 files changed, 9 deletions(-) diff --git a/svglib/svglib.py b/svglib/svglib.py index 894311f..ac9bedf 100755 --- a/svglib/svglib.py +++ b/svglib/svglib.py @@ -36,7 +36,6 @@ ) from reportlab.lib import colors from reportlab.lib.units import pica, toLength -from reportlab.lib.utils import haveImages try: from reportlab.graphics.transform import mmult @@ -1252,12 +1251,6 @@ def convertPath(self, node): return gr def convertImage(self, node): - if not haveImages: - logger.warning( - "Unable to handle embedded images. Maybe the pillow library is missing?" - ) - return None - x, y, width, height = self.convert_length_attrs(node, 'x', 'y', 'width', 'height') image = node._resolved_target image = Image(int(x), int(y + height), int(width), int(height), image) diff --git a/tests/test_samples.py b/tests/test_samples.py index 1eee637..f38976e 100755 --- a/tests/test_samples.py +++ b/tests/test_samples.py @@ -21,7 +21,6 @@ from os.path import dirname, splitext, exists, join, basename, getsize from urllib.parse import quote, unquote, urlparse -from reportlab.lib.utils import haveImages from reportlab.graphics import renderPDF, renderPM from reportlab.graphics.shapes import Group, Rect import pytest @@ -414,7 +413,6 @@ def test_convert_pdf_uniconv(self): class TestOtherFiles: - @pytest.mark.skipif(not haveImages, reason="missing pillow library") def test_png_in_svg(self): path = join(TEST_ROOT, "samples", "others", "png_in_svg.svg") drawing = svglib.svg2rlg(path)