From 55d48519c9132c6d213f2e733bcd806e3b1f05fb Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 11 Oct 2015 08:16:28 +0200 Subject: Change image size calculation Use ImageMagick::Image::ping to determine the size of an image, but only if the file size is < 400kb to prevent the impression of a deadlock. --- helper.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'helper.cpp') diff --git a/helper.cpp b/helper.cpp index ed1d31a..dd6bedf 100644 --- a/helper.cpp +++ b/helper.cpp @@ -308,12 +308,10 @@ namespace Helper { } QVariant picSize(const QString &path){ - QImage img(path); - if(!img.isNull()){ - QString retval = QString("%1x%2").arg(QString::number(img.width())).arg(QString::number(img.height())); - return retval; - } - return QVariant(); + Magick::Image img; + img.ping(qPrintable(path)); + QString retval = QString("%1x%2").arg(QString::number(img.columns())).arg(QString::number(img.rows())); + return retval; } PicData convertToPng(PicData data){ -- cgit v1.2.3-70-g09d2