mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
19 lines
405 B
C++
19 lines
405 B
C++
#include "imageutils.h"
|
|
|
|
#include <QMimeDatabase>
|
|
|
|
using namespace vnotex;
|
|
|
|
QImage::Format ImageUtils::guessImageFormat(const QByteArray &p_data)
|
|
{
|
|
auto image = QImage::fromData(p_data);
|
|
return image.format();
|
|
}
|
|
|
|
QString ImageUtils::guessImageSuffix(const QByteArray &p_data)
|
|
{
|
|
QMimeDatabase mimeDb;
|
|
auto mimeType = mimeDb.mimeTypeForData(p_data);
|
|
return mimeType.preferredSuffix();
|
|
}
|