Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
src_gui_image_qimagewriter.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QImage>
4#include <QImageWriter>
5
7
8void wrapper0() {
9
11QImageWriter writer;
12writer.setFormat("png"); // same as writer.setFormat("PNG");
14
15} // wrapper0
16
17
18void wrapper1() {
19
21QImage image("some/image.jpeg");
22QImageWriter writer("images/outimage.png", "png");
23writer.setText("Author", "John Smith");
24writer.write(image);
26
27} // wrapper1
28
29
30void wrapper2() {
32
36 writer.setText("Author", "John Smith");
38
39} // wrapper 2
40
41
42void wrapper3() {
44
46QImageWriter writer("some/image.dds");
48 writer.setSubType("A8R8G8B8");
49writer.write(image);
51
52} // wrapper3
53} // src_gui_image_qimagewriter
The QImageWriter class provides a format independent interface for writing images to files or other d...
bool write(const QImage &image)
Writes the image image to the assigned device or file name.
bool supportsOption(QImageIOHandler::ImageOption option) const
void setSubType(const QByteArray &type)
void setFormat(const QByteArray &format)
Sets the format QImageWriter will use when writing images, to format.
void setText(const QString &key, const QString &text)
\inmodule QtGui
Definition qimage.h:37
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Definition image.cpp:4