From 795ab3471475307d4d3482c32a6aaf0a19e85d8c Mon Sep 17 00:00:00 2001 From: Jonas Havelka Date: Tue, 6 Apr 2021 23:11:22 +0200 Subject: [PATCH] Fix convert to gs --- seminar/models.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/seminar/models.py b/seminar/models.py index 63c9bdfa..afa54367 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -602,13 +602,18 @@ class Cislo(SeminarModelBase): png_filename = pathlib.Path(tempfile.mkdtemp(), 'nahled.png') subprocess.run([ - "convert", - "-density", "300x300", - "-geometry", "{}x{}".format(VYSKA, sirka), - "-background", "white", - "-flatten", - "{}[0]".format(self.pdf.path), # titulní strana - png_filename + "gs", + "-sstdout=%stderr", + "-dSAFER", + "-dNOPAUSE", + "-dBATCH", + "-dNOPROMPT", + "-sDEVICE=pngalpha", + "-r{}x{}".format(VYSKA, sirka), + "-dFirstPage=1d", + "-dLastPage=1d", + "-sOutputFile=" + str(png_filename), + "-f%s" % self.pdf.path ], check=True, capture_output=True