From 7c90b2c4517695106540191d243e7e2783266751 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Thu, 19 Jan 2017 20:32:16 +0100 Subject: [PATCH] restore backwards compatibility and allow passing images as a list --- src/img2pdf.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/img2pdf.py b/src/img2pdf.py index 74ebb5e..ce44db0 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -992,6 +992,13 @@ def convert(*images, title=None, viewer_fit_window, viewer_center_window, viewer_fullscreen, with_pdfrw) + # backwards compatibility with older img2pdf versions where the first + # argument to the function had to be given as a list + if len(images) == 1: + # if only one argument was given and it is a list, expand it + if isinstance(images[0], (list, tuple)): + images = images[0] + for img in images: # img is allowed to be a path, a binary string representing image data # or a file-like object (really anything that implements read())