-
Notifications
You must be signed in to change notification settings - Fork 0
/
getOrientation.cpp
37 lines (34 loc) · 1.02 KB
/
getOrientation.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "mainWindow.h"
#include <QFile>
#include <QDebug>
#include "exif.h"
// only for qDebug() below
#if 0
static const char * orients[] = {
"undefined",
"normal",
"hori flip",
"180 rot",
"vert flip",
"transpose",
"90 rot",
"transverse",
"270 rot",
};
#endif
int MainWindow::getOrientation(const QString &filename, QString &qdatetime)
{
char datetime[21];
memset(datetime,0,21);
QFile file(filename);
int orientation = 0;
if (file.open(QIODevice::ReadOnly) == true) {
Exif exif;
exif.readJpegSections(file, &orientation,datetime);
file.close();
}
// qDebug() << "Orienta " << orients[orientation];
// qDebug() << "datetime" << datetime;
qdatetime = datetime;
return orientation;
}