Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
10//! [0]
11QImageWriter writer;
12writer.setFormat("png"); // same as writer.setFormat("PNG");
13//! [0]
14
15} // wrapper0
16
17
18void wrapper1() {
19
20//! [1]
21QImage image("some/image.jpeg");
22QImageWriter writer("images/outimage.png", "png");
23writer.setText("Author", "John Smith");
24writer.write(image);
25//! [1]
26
27} // wrapper1
28
29
30void wrapper2() {
31QString fileName;
32
33//! [2]
34QImageWriter writer(fileName);
35if (writer.supportsOption(QImageIOHandler::Description))
36 writer.setText("Author", "John Smith");
37//! [2]
38
39} // wrapper 2
40
41
42void wrapper3() {
43QImage image;
44
45//! [3]
46QImageWriter writer("some/image.dds");
47if (writer.supportsOption(QImageIOHandler::SubType))
48 writer.setSubType("A8R8G8B8");
49writer.write(image);
50//! [3]
51
52} // wrapper3
53} // src_gui_image_qimagewriter