Sitting in one of the villages in the heart of Africa, I wanted to convert the format of my image from JPEG to PNG. Lack of internet connectivity, I had to do something offline, there came to my mind the use of MATLAB Graphic User Interface (GUI). So I decided to develop a platform that can allow me to convert the format of my images with a few lines of code. in this project, we will be showing you step by step how you can develop and customize your own interface that can convert your image to the format of your choice.
In order to achieve this project, we went through the following steps
- GUI development
- Code formation.
Graphical User Interface Development
A graphical user interface (GUI) is a visual interface that allows a user to interact with an application without having to know the language.This is accomplished by giving simple controls. The controls are the buttons that the user presses in order to get a specific result. A graphical user interface (GUI) is an event-driven application. This is due to the fact that it accepts input at any moment and uses callback functions to execute the program and return results.
We'll look at the components that go into making the graphical user interface in this project. We'll also look at how to construct the components' callback functions, which enable them to execute the controls.
How can I get to the graphical user interface?
We start off by first hitting into the command window and type ‘guide’ a window like this will pop upA new window appears when MATLAB GUI executes this command. This window provides a number of GUI templates for the user to choose from while creating their design.
We'll use a blank GUI template in this project because it will help us apply the foundations of the GUI. The workspace appears when you select a template. This is where we create our user interface before creating the component callbacks.
Lists of components in the blank GUI
- Push Button - Its purpose is to invoke the callback function, which is used to execute various programs.
- Slider - A slider is a type of scroll bar that has a numerical value. When the user moves the pad, the callback function is invoked and executed. Drag the pad to the desired location or click the forward or backward arrow to modify the position.
- Check Box - It has two states: on and off. A tick inside the box represents the on state. They're clustered together, and many checkboxes can be selected at the same time.
- Edit Text — This method is used to obtain strings from the user. The str2num or str2double functions can then be used to convert the input to numbers.
- Static Text — Is used to add labels to the GUI that don't change and don't have any callbacks.
- Pop-up Menu — It is used to display a list of options. You may inspect the selections by clicking on it, and the callback function is then executed based on the selection.
- The radio button ----Â on and off. By clicking on it, you can modify its state. It is on when the button has a solid circle within the hollow circle. It is, however, off when the hollow circle is empty. They're clustered together, and only one of them can be active at any given moment.
- The list box, like the pop-up menu, displays a list of options. Unlike the pop-up menu, where only the current selection is visible, the list box displays all of the options.
- Toggle Button — Similar to a radio button, but with a different appearance in the user interface. It's the outward appearance that counts.
- Table — This element is used to add a spreadsheet to the GUI. The callback is executed if the input is changed.
- Images, charts, and plots can be added to the GUI using axes. They don't have a callback function.
- Panel - It's used to gather together a variety of components and names based on their function. There isn't a callback function.
- Button Group — A button group is similar to a panel, but it is used to group radio buttons. Here's where we'll arrange the radio buttons. We add the button group first, then the radio buttons, much like a panel.
Components used in this project:
- Axes
- Push Buttons
- Static Text