example 'camera': fix orientation of both video and saved images

This commit is contained in:
pls.153 2022-11-08 16:55:09 +01:00
parent 5ca13c542b
commit c18b2c13e9
11 changed files with 142 additions and 9 deletions

View file

@ -0,0 +1,33 @@
#include "qt.h"
#include <QImage>
#include <QtDebug>
#ifdef PLUGIN
#include <ecl_fun_plugin.h>
#else
#include <ecl_fun.h>
#endif
QT_BEGIN_NAMESPACE
QObject* ini() {
static QObject* qt = nullptr;
if (qt == nullptr) {
qt = new QT;
#ifdef PLUGIN
ini_lisp();
#endif
}
return qt;
}
QVariant QT::rotateImage(const QVariant& imagePath, const QVariant& angle) {
// rotates image, replacing it; must be called from the UI thread, see QRUN*
QString path(imagePath.toString());
QImage img(path);
QImage rotated = img.transformed(QTransform().rotate(angle.toReal()));
rotated.save(path);
return imagePath;
}
QT_END_NAMESPACE