[LyX/master] Use correct bounding box when exporting from command line
Enrico Forestieri
forenr at lyx.org
Fri Sep 25 18:38:42 UTC 2020
commit f0807a604cf177da385867a684143782eb9921d8
Author: Enrico Forestieri <forenr at lyx.org>
Date: Fri Sep 25 20:58:40 2020 +0200
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.
---
src/insets/InsetGraphics.cpp | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index 957e002..b20e9a7 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -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;
More information about the lyx-cvs
mailing list