Changing size of image
-
Hi. I want to load .bmp file to QImage, add some pixels and change QImage's size. QImage is part o a class, eg.:
@
#include <QGraphicsView>
#include <QImage>class obraz : public QGraphicsView
{
Q_OBJECT
public:
explicit obraz(QWidget *parent = 0);
QImage image;
};
@How to change QImage size?
-
You mean like "scaling":http://developer.qt.nokia.com/doc/qt-4.8/qimage.html#scaled an image ?
@
Image.scaled(Size, Qt::KeepAspectRatio);
@ -
Doesn't work. And how to load another QImage to QImage?
-
[quote author="grizz" date="1328524306"]Doesn't work. [/quote]
Did you observe that scaled returns the scaled QImage?
It is not listed in "the in-place section":http://developer.qt.nokia.com/doc/qt-4.8/qimage.html#image-transformations[quote author="grizz" date="1328524306"]And how to load another QImage to QImage?[/quote]
Did you try ?:
@
Image = Image.scaled(Size, Qt::KeepAspectRatio);
@ -
Now it works. I tried something like that earlier and it didn't work, but now I know what I made wrong. Thank you.