WxWidgets and Magick++ v/s Qt : My Experience with Photopal

Photopal is the name of a simple desktop application i worked on. Users can simply drag and drop the image and it is converted to preferred resolution by the user (default 72dpi). Drop large number of images or folders and it’ll convert them efficiently.
I created this application using two popular libraries — wxWidgets and Qt. I’ll explain them both first if someone wants to use them and then i’ll compare them both.
Approach 1 — WxWidgets and Magick++ :
How to use WxWidgets in Windows ?
Download the wxWidgets source from https://www.wxwidgets.org/downloads/ . UnZip the file you downloaded.
Now under the wxWidgets folder navigate to /build/msw .
You will find various visual studio projects names as wx_vc follwed by visual studio version e.g. for visual studio 13 it is wx_vc12 .
Open it in Visual Studio and compile it using the configuration you want for e.g. release in x64 .
The corresponding files will be created in the wxWidgets folder under include and lib folder respectively. The required files for wxWidgets are generated.
To include it in your project , open the properties of your project.
Under C/C++ properties — General tab , give path to your (wxWidgets)/include and (wxWidgets)/include/msvc folder in Additional Include Directories.
Under C/C++ properties — Preprocessor — Preprocessor Definitions , add WIN32 , WXUSINGDLL , _WXMSW , wxMSVC_VERSION_AUTO , _UNICODE and UNICODE.
Now under Linker — General — Link Library Dependencies add path to your lib/vc folder which contains your dll files e.g. vc120_x64_dll.
Under Linker — Input — Additional Dependencies add lib files you need e.g. wxmsw31u_core.lib , wxmsw31u_gl.lib and wxbase31u.lib.
WxWidgets is all setup now.
How to use Magick++ in Windows?
Download the Magick++ source https://www.imagemagick.org/script/download.php and unzip it.
To create a workspace for your requirements, simply go to the
VisualMagick\configure folder and open the configure.dsw workspace (for
Visual Studio 6) or configure.sln (for Visual Studio 7 or 8).
Set the build configuration to Release or Debug. Build and execute the configure program and follow the on-screen instructions.
After a successful build, all of the required files that are needed to run
any of the command line tools are located in the VisualMagick\bin folder. This includes EXE, DLL libraries, and ImageMagick configuration files.
To run it in your project simply define the reference to the header files (include directory) and lib files (lib directory ) in the visual studio.
Also add CORE_RL_Magick++_.lib and CORE_RL_MagickCore_.lib to additional dependencies under Linker — Input .Also copy the xml files to the executable location.
Now comes the tricky part , imagemagick runs only on systems where it is already installed. To overcome this difficulty , simply download the exe file of imagemagick. Go to Program files/ imagemagick and copy the dll files under coders folder. Now imagemagick is ready to be run.
How to use WxWidgets in Ubuntu ?
Open up the terminal and type
deb http://apt.wxwidgets.org/ natty-wx main
deb-src http://apt.wxwidgets.org/ natty-wx main
To add digital signature type :
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add -
Run the following commands in terminal:
sudo apt-get update
sudo apt-get install wx2.8-headers libwxgtk2.8–0 libwxgtk2.8-dev
cd /usr/include
ls | grep wx
sudo ln -sv wx-2.8/wx wx
Add `wx-config — cxxflags` `wx-config –libs` and required wxWidgets libraries to the g++ command while compiling WxWidgets project.
How to use Magick++ in Ubuntu?
Open up the terminal and build essentials for Magick++ as:
sudo apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
Now Download the ImageMagick by typing:
sudo wget http://www.imagemagick.org/download/ImageMagick.tar.gz
Unzip the tar :
sudo tar xzvf ImageMagick.tar.gz
Run the following commands in terminal :
cd ImageMagick-7.0.4–5
./configure
make clean
make
checkinstall
ldconfig /usr/local/lib
ImageMagick is ready to run on your system.
Approach 2 — Qt :
How to use Qt?
Download the Qt from the official website using the online or the offline installer — https://www.qt.io/download-open-source/
After installation , open the Qt creator.Create a Qt Project and run it in the release or debug mode.
Build a distributable in Qt :
Go to the C:\Qt\(version)\(compiler)\bin . e.g. C:\Qt\5.9.1\msvc2013_64\bin
Open the terminal here and run :
windeployqt (location of your binary file) .
Your distributable executable along with the required dll is automatically made.
Comparison Of WxWidget and Magick++ vs Qt :
WxWidgets is just a Gui library and needed Magick++ for Image processing while Qt in itself was a fully fledged library and contains various utilities , one of which was image processing. One can easily notice that using Qt is less complex than WxWidgets . Even the code for Qt is simple to write and understand.
But with ease comes increase in level of abstraction . Qt is way more abstract than WxWidgets which was quite noticeable when i worked on pthread in wxWidgets and Qt’s own thread QThread. So it depends on your area of application whether you want to work with Qt or WxWidgets. In my particluar case though, Qt was a better choice.
If you face any difficulty in implementing any of these libraries , i’ll be happy to help.
