JPG, PNG and BMP image compression using discrete cosine transform

This paper proposes image compression using discrete cosine transform (DCT) for the format of joint photographic expert groups (JPEG) or JPG, portable network graphic (PNG) and bitmap (BMP). These three extensions are the most popular types used in current image processing storage. The purpose of image compression is to produce lower memory usage or to reduce memory file. This process removes redundant information of each pixel. The challenge for image compression process is to maintain the quality of images after the compression process. Hence, this article utilizes the DCT technique to sustain the image quality and at the same time reduces the image storage size. The effectiveness of the DCT technique has been reasonable over some real images and the implementation of the technique has been compared with different types of image extensions. Matlab software is an important platform for this project in order to write a program and perform the progress of project phase by phase to achieve the expected results. Based on the tested images, the DCT technique in image compression is capable to reduce the image storage memory in average about 50% of each image tested.


INTRODUCTION
In this new era, photo or image had become one of the crucial things in our daily life. Due to that, image compression is important for many uses for various applications that consist of huge storage of data and recovery such as for multimedia, documents and medical imaging. According to [1], the purpose of image compression technique is to decrease size of the image data with the intention of to store or transfer data in an efficient method because uncompressed images have need of large storage capacity and transmission bandwidth [2]. Moreover, the maintainable of the quality of image are the most important thing in compressing the image [3]. Other than that, image processing or compression also widely used in medical imaging such as X-ray, MRI/FMRI (function magnetic resonance), dynamic 3D ultrasound and others [4]. Due to that matter, there are several image compression methods such as discrete wavelet transform (DWT), set partitioning in hierarchical trees (SPIHT) and other required methods. All of them had same main goal which is to reduce the size of image [5]. For DWT image compression system, there are three important stages that required which are transformation, quantization and entropy coding [6].

1011
In Figure 1, the block diagram defines the encoding and decoding methods. The encode part consists of continuous process with wavelet transformation, quantization and entropy coding. The decode part starts with entropy decoding, de-quantization and inverse wavelet. The inverted stages are executed to create a decoder. Then, the de-quantization is only the dissimilar part in the decoding process. It tailed by an inverse transform with the purpose of estimate the original image [7]. With the compressed image, the information of an image can be divided by using wavelet analysis into estimation and detail sub-signals. The estimation sub-signal shows the common trend of pixel values while three detail sub-signals show the horizontal, vertical and diagonal details or modifications in the image [8]. They can be set to zero without significantly changing the image if these details are tiny then. As information, if the values lower than details are considered small enough to be set to zero, it called as threshold. In hypothesis, the size of compression could be huge as the greater the number of zeros. The amount of data maintained by an image after compression and decompression is identified as the energy maintained that relational to the quantity of the squares of the pixel values. The compression called as lossless if the energy retained is 100% as the image can be reconstructed correctly [9]. This happens when the threshold value is set to zero and nothing changed in detail. Other than that, lossy compression occurs if any values are changed then energy is lost. In addition, the energy retention and the quantity of zeros will be as great as possible during compression. However, more energy will be lost if more zeros obtained [10]. The discrete cosine transform (DCT) is applied by various applications such as image processing and signal-processing DSP applications. DCT also used in conversion for data compression. It has a fixed set of basis function which called an orthogonal transform. It also used to plan an image space into a frequency [11]. There are several benefits of DCT such as it has the capability to pack energy for image data in lower frequencies. It also able to decrease the blocking artefact effect and this outcome become evident. Next, according to [12], joint photographic expert groups (JPEG) standard is one of the most common compression standards. There are some modes established for JPEG such as baseline, lossless, progressive and hierarchical. DCT's most common used is the JPEG baseline coding system and proper for most applications of compression.
JPEG is very supportive for DCT quantization and compression although being developed for low compressions [13]. Besides, JPEG compression also shrinks size of file with lowest image deprivation by removing the minimum important information. Lossy image compression technique is considered since the final and original image are not totally same [14]. It is reasonable in lossy compression for information that may be lost and missed. Next, the Figure 2 shows the JPEG process steps for colour images. SPIHT algorithm with wavelets is used in order to represent the technique for compression of grayscale and colour images [15]. Furthermore, different wavelets are applied so that compression can be complete using at dissimilar levels of decomposition. The coding of SPIHT as shown by Figure 3 is used in this technique with biorthogonal wavelets at four different levels of decomposition. Next, in order to signify the image based on the terms of two sub-signals, the wavelet analysis can be used. Then, the approximation sub-signal captures the general trends in the image samples and detail sub-signal which consists high frequency vertical, horizontal and diagonal information [16]. There are three main purposes of this project. First, the size of the designated image should be able to decrease based on discrete cosine transform (DCT) method. Then the second objective is to sustain the quality of an image before and after the compression process. This is to make sure the features of original image are not affected by the compression process. Third, this paper is to analyze the effectiveness of the result based on the proposed method.
This image compression technique focuses on large community of people based on required condition. Firstly, it focuses on community of people that wants to store the image into certain amount of memory card, USB flash drive, hard disk or other required storage devices. Due to that matter, the smaller size of image, the more image able to store in the required storage. Next, this technique also focuses to the users that have intention to send the image data and download image via Internet. Nowadays, "Whatsapp" is one of the main  [17]. With smaller size, the time for transfer the image will be reduced and decrease the uses of data plan. In addition, this technique also focuses on the entrepreneur that runs printing services. Due to that matter, the smaller size of image or picture will lessen the time consumed for printing and the quality of image is sustainable [18]. So, a lot of time will be saved and lower the printing costs.

RESEARCH METHOD
This project is using Matlab as a main software tool. As information, Matlab is stands for "Matrix Laboratory" [19]. Matlab is generally applied in wide areas include mathematics, education at university and in the industry. Due to that, there are so many Matlab users that come from different backgrounds. The Matlab software is made up of vectors and matrices. It also creates the software program mainly convenient for linear algebra. Other than that, Matlab is one of particular tool for solving algebraic and differential equations [20]. Matlab additionally and able to provide fine image in both 2D and 3D and has great graphic tools. The most important is it has been one of the best programming languages for perform mathematical algorithms. It consists of matrix operations, plotting of functions and data, operation of algorithms, user interfaces, and other interfacing [21]. Matlab also have several device boxes that valuable for signal processing, image processing, optimization and others [22].

Discrete cosine transform
This project proposes an image compression technique using DCT which is reliable and efficient method of image compression. It provides the result of image quality [23]. Based on the block diagram Figure 4, it shows the development of the image compression technique. After executed program, original image must be selected as an input image. Then, proceed to the cosine transform process and through the quantization process. Next, proceed to encoder process where it simply converting data from one format to another format to achieve better resolution of image [24]. Then the image will be compressed. After that, the decoding process takes place which it acts as inverse encoding. Then, go through inverse quantization and inverse cosine transform as they act opposite process in order to perform the reconstructed image.
Based on a flowchart of Figure 5, it shows the project development process. For the first step, the original input image is selected and uploaded in the system in order to be compressed. The system will read the input image and will be tested whether the types of image uploaded is correct or not. The types of image that can be compressed are 'JPG', 'portable network graphic (PNG)' and 'bitmap (BMP)'. If other types of image have been selected, it will provide error to the system and user needs to upload again the correct type of original image. If the type of image is correct, then the image will be displayed with original image's size. Next, the system will allow the compression process with DCT method. If the image unable to be compressed, then it turns back to the first step to troubleshoot and user needs to upload the original image again [25].

CONCLUSION
As conclusion, all the objectives of this project had been achieved. Using this compression technique, users are able to compress and reduce the size of image in order to store the image with small size of capacity and other required intentions. Other than that, the user should not be worry about the condition of image due to compression process because the quality of input image and compressed image is preserved due to a reasonable amount loss of data. Besides, the effectiveness of this compression technique is proved by observing and identifying the analysis of the results that had been recorded in Figures 6 and 7. The effectiveness of the DCT is capable to reduce about 50% of the image storage file and maintain the image quality.

ACKNOWLEDGEMENT
This work is supported by a grant from the Universiti Teknikal Malaysia Melaka with the reference number JURNAL/2018/FTK/Q00008.