From f179c606b13d81489b6ad50139dcf4bd0577f926 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sun, 29 Nov 2020 01:29:51 +0100 Subject: [PATCH] get our graphics page size for small printer --- screenless/bureau/bureau.py | 5 +++++ screenless/bureau/publicrelations/publicrelations.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index 266a54a..6ea8e0f 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -230,6 +230,11 @@ class Bureau(object): else: self.smprint["profile"] = printcaps.get_profile(profile) + page_width = self.smprint["profile"].profile_data['media']['width']['pixels'] + if page_width == "Unknown": + page_width = 576 + self.smprint["width"] = int(page_width) + self.lp = {} self.lp["name"] = printcfg["largeprinter"]["name"] self.lp["papersize"] = printcfg["largeprinter"]["papersize"] diff --git a/screenless/bureau/publicrelations/publicrelations.py b/screenless/bureau/publicrelations/publicrelations.py index 5c5254c..559e1b6 100644 --- a/screenless/bureau/publicrelations/publicrelations.py +++ b/screenless/bureau/publicrelations/publicrelations.py @@ -173,7 +173,7 @@ class PublicRelations(Bureau): im = PIL.Image.open(filename) if im.mode in ("L", "RGB", "P"): im = PIL.ImageOps.equalize(im) - im.thumbnail((self.smprint["width"], 576), PIL.Image.ANTIALIAS) + im.thumbnail((self.smprint["width"], 960), PIL.Image.ANTIALIAS) prn.image(im, impl="bitImageColumn") tw_shortcode = self.short_tweet_id(t["id_str"])