Use correct bounding box when exporting from command line

Without GUI an image is not available even if it is actually cached.
In this case we load the image for obtaining its dimensions in order
to correct the clipping bounding box.

This amends 380f34a1.
This commit is contained in:
Enrico Forestieri 2020-09-25 20:58:40 +02:00
parent a8572c1358
commit f0807a604c

View File

@ -93,6 +93,7 @@ TODO
#include "support/Systemcall.h"
#include <QProcess>
#include <QtGui/QImage>
#include <algorithm>
#include <sstream>
@ -340,6 +341,12 @@ void InsetGraphics::outBoundingBox(graphics::BoundingBox & bbox) const
height = image->height();
}
}
// Even if cached, the image is not loaded without GUI
if (width == 0 && height == 0) {
QImage image(toqstr(file.absFileName()));
width = image.width();
height = image.height();
}
if (width == 0 || height == 0)
return;