Converting images
In this section, we will learn how to build a simple image converter that converts an image from one format into another. Qt supports reading and writing different types of image formats, and this support comes in the form of external DLL files due to licensing issues.
However, you don’t have to worry about that because as long as you include those DLL files in your project, it will work seamlessly across different formats. There are certain formats that only support reading and not writing, and some that support both.
Note
You can check out the full details about converting images at http://doc.qt.io/qt-6/qtimageformats-index.html.
How to do it…
Qt’s built-in image libraries make image conversion really simple:
- Open Qt Creator and create a new Qt Widgets Application project.
- Open
mainwindow.ui
and add a line edit and push button to the canvas to select image files, a combo box to select the desired file format, and...