From ad7682b0d6c7605bd5b6b7e93ee1def73637cb6d Mon Sep 17 00:00:00 2001 From: Timm Date: Thu, 27 Jun 2024 22:51:09 +0200 Subject: [PATCH] #174 address issue when trying to convert a jpg to jpg --- src/selphyprinter.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/selphyprinter.cpp b/src/selphyprinter.cpp index 0c03bd4..458dd7d 100644 --- a/src/selphyprinter.cpp +++ b/src/selphyprinter.cpp @@ -45,7 +45,17 @@ int SelphyPrinter::printImage(const QString &filename, int copyCount) { if(mIp.length() > 0) { - QString imageMagickCommand = "convert " + filename + " -quality 100% " + filename + ".jpg"; + QString imageMagickCommand; + if(filename.endsWith(".jpg") || filename.endsWith(".jpg")) + { + imageMagickCommand = ":"; // file is already a JPG. No conversion to be done + } + else + { + // file is not a JPG. First convert to JPG. + imageMagickCommand = "convert " + filename + " -quality 100% " + filename + ".jpg && rm " + filename; + } + QString selphyCommand = "selphy -printer_ip=" + mIp + " " + filename + ".jpg"; QString printCommand = imageMagickCommand; for(int i = 0; i < copyCount; i++)