Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
35if (writer.supportsOption(QImageIOHandler::Description))
36 writer.setText("Author", "John Smith");
38
39} // wrapper 2
40
41
42void wrapper3() {
44
46QImageWriter writer("some/image.dds");
47if (writer.supportsOption(QImageIOHandler::SubType))
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...
void setFormat(const QByteArray &format)
Sets the format QImageWriter will use when writing images, to format.
\inmodule QtGui
Definition qimage.h:37
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Definition image.cpp:4