Files
seer/tests/helloimage/helloimage.cpp
T

38 lines
1.1 KiB
C++
Raw Normal View History

#include <string>
#include <iostream>
#include <fstream>
#include <filesystem>
2022-10-29 12:27:10 -05:00
#include <QtGui/QImageReader>
#include <QtCore/QDebug>
int main (int argc, char** argv) {
std::cout << "Hello, Image!" << std::endl;
2022-10-29 12:27:10 -05:00
QImageReader reader("lena.bmp");
reader.setAutoTransform(true);
2022-10-29 12:27:10 -05:00
QImage image = reader.read();
if (image.isNull()) {
return false;
}
2022-10-29 12:27:10 -05:00
QImage image_rgb = image.convertToFormat(QImage::Format_RGB888);
QImage image_rgba = image.convertToFormat(QImage::Format_RGBA8888);
2022-10-29 12:27:10 -05:00
qDebug() << image;
qDebug() << image_rgb;
qDebug() << image_rgba;
2022-10-29 12:27:10 -05:00
// QImage(QSize(512, 512),format=QImage::Format_Indexed8,depth=8,colorCount=256,devicePixelRatio=1,bytesPerLine=512,sizeInBytes=262144)
// QImage(QSize(512, 512),format=QImage::Format_RGB888,depth=24,devicePixelRatio=1,bytesPerLine=1536,sizeInBytes=786432)
// QImage(QSize(512, 512),format=QImage::Format_RGBA8888,depth=32,devicePixelRatio=1,bytesPerLine=2048,sizeInBytes=1048576)
2022-10-29 12:27:10 -05:00
const uchar* bits = image.bits();
const uchar* bits_rgb = image_rgb.bits();
const uchar* bits_rgba = image_rgba.bits();
return 0;
}