Reducing Pixel Range to Improve Image Compression Quality

Objective: This study aims to contribute in developing a compression method that performs both high quality and applicable compression ratio, which is a hard task and requires a lot of sequential experiments since each of the aimed characteristics belong to different group type of image compression techniques lossy and lossless. Therefore, the hybridization between those two types is the convenient solution because it allows the desired results to appear in one technique. Methods/Findings: The researcher proposed reducing the pixel range that represents the original image by a fixed rate, which yields to reducing the repetition and preserving a large amount of the data in this phase before proceeding to the lossy part, in this case, RIFD technique that will affect better reducing the compressed image size due to the previous step. The Calculations of the objective measurements MSE, MAE and PSNR used to assess the effect of the suggested method (RPR) by collecting the results which gained after applying it to different grayscale and colour images. Application: The proposed lossless part does not require complex calculations and the results proved its ability to improve the compression quality for the elected lossy technique without affecting the compression ratio. Comparisons showed significant improvement on grey scale images especially those having 16-bit depth and marginally in RGB images. 1. Significant of the Study Image compression becomes an important part of image processing, different image compression method was improved to provide high image quality and better compression ratio, which come to be more acceptable than traditional image compression algorithms, that have lack adaptability and are agnostic to the data being compressed. This study suggested Reducing Pixel Range (RPR) Compression Method, this method has evolved from a previous methods like (RIFD) that has improved image compression ratio but has not improved image quality, also its come to support other study which proposed new algorithm (FMM) which improved image quality and compression ratio, experimental results show that RPR gain better quality and better compression ratio than other methods. 2. Introduction Image processing is a rapidly growing methodology within computer science1. Image processing has many fundamental procedures but can be summarized as: importing the image or image acquisition, analysing and adjusting and finally the output that can be either a modified image or an analysis report2. Many researches are searching continually to find new compression methods that would overpass old classic methods for compressing images or even other kind of data such as Cosine Transform, Fourier Transform, Huffman and other more. This will require intensive experiments to discover new idea for image compression One of the approaches which is widely studied is combining the two main techniques types intending to increase both quality and compression ratio3. *Author for correspondence Indian Journal of Science and Technology, Vol 12(20), DOI: 10.17485/ijst/2019/v12i20/142921, May 2019 ISSN (Print) : 0974-6846 ISSN (Online) : 0974-5645


Significant of the Study
Image compression becomes an important part of image processing, different image compression method was improved to provide high image quality and better compression ratio, which come to be more acceptable than traditional image compression algorithms, that have lack adaptability and are agnostic to the data being compressed. This study suggested Reducing Pixel Range (RPR) Compression Method, this method has evolved from a previous methods like (RIFD) that has improved image compression ratio but has not improved image quality, also its come to support other study which proposed new algorithm (FMM) which improved image quality and compression ratio, experimental results show that RPR gain better quality and better compression ratio than other methods.

Introduction
Image processing is a rapidly growing methodology within computer science 1 . Image processing has many fundamental procedures but can be summarized as: importing the image or image acquisition, analysing and adjusting and finally the output that can be either a modified image or an analysis report 2 .
Many researches are searching continually to find new compression methods that would overpass old classic methods for compressing images or even other kind of data such as Cosine Transform, Fourier Transform, Huffman and other more. This will require intensive experiments to discover new idea for image compression One of the approaches which is widely studied is combining the two main techniques types intending to increase both quality and compression ratio 3 .
This study will discuss a novel loss technique which is RIFD that employed rounding process to reduce the image size and perform good compression ratio and acceptable quality. The researcher will propose an enhancement method that will preserve the same compression ratio but with significant improvement in quality RIFD 4 .
Briefly, this study examines previous studies that have improved image processing. The researcher assumed a new algorithm, using mathematical operations, to apply image compression techniques and formulated the appropriate programming code using MATLAB on many different images of colored, grey, white and black.

Image Compression
Compression techniques are mainly of two types lossy and lossless, each type has its own characteristics and applications. Employing lossy techniques produce high compression ratio but at the expense of quality. On the other hand, lossless techniques presented high quality but with a much lower compression ratio 5 .
The possible technique to decreasing the necessary amount of storage required to save the images is to perform compressed image data methods. If compression is the basic goal of the method, a compressed image is represented utilizing lowest number of bits per pixel, without losing the capability to reconstruct the original image.
It is important to find statistical features of the image to design a suitable compression conversion of the image. Before any compression there is two points should be determined: Firstly, image data properties that can be found in gray level histogram, image entropy and different correlation operation and the next is to find suitable compression method design 6 .
Compression methods have two principal types: -Lossless compression: Information preserving compression that allows data reconstruction with free error. It's type of data compression algorithms which permits the original data to be successfully regenerate from the compressed data. Opposite to the lossy compression that allows reconstruction just of an approximation of the original data 7 . -Lossy compression: Defined as data encoding algorithms which uses in exact approximations and partial data discarding to exemplify the content. Those techniques can be used to minimize data size for storage and transmitting content, lossy compression advantage is that it can minimize file sizes higher more than lossless compression 8 .

Image Compression Importance
Image compression is simply for saving space and time.
For example, the storage space could hold ten raw images (uncompressed) or hold hundred compressed ones. We gain more value for memory price. When we want to view an image from the Internet on any mobile phone we might need to wait more than five seconds to download a raw one or one second when downloading a compressed image. This gives to user experience and leads your data plan to be cheaper. File size reduction lets image to be stored in a given amount of memory space. Compressed image consider as optimized one for a web page making it load time faster, also it play a major role in retaining the attention of users 9 .
Image compression can help greatly to minimize the size of an image file, it could also expose the quality of an image and also there may not be any recovery. So this reason that many researchers recommend saving the images in a lossless format like as TIFF, File compression decrease the amount of space needed to store data. This can free up valuable space on the hard drive, a web server.
Data compression is specifically useful in communications because it authorize devices to convey or store the same value of data in fewer bits, also there are file compression formats, like ARC and ZIP. Data compressed in signal processing, source coding, data compression, bitrate reduction contains encoding information utilizing fewer bits than the original representation. Compression can be either lossy or lossless, where lossless compression reduces bits by detecting and eliminating statistical redundancy.
So image compression, (compaction), the process of decreasing the amount of data needed for the storage or transition of a given segment of information, specifically by the utilize of encoding techniques, encoding has the important prosperity that no code is a prefix of any other, image Decompression is the method of restoring compressed data to its original image, image decompression is needed in almost all situation of compressed image, which include lossy and lossless compression 10 .

Quality Evaluation Metrics
There are two major Evaluations Metrics class, the first one Subjective, (HVS), this kind earn along with Human Visual System. The second one objective which contained (MSE), (PSNR) and (MAE) that perform mathematical calculation to compare between original and de-compressed image.

(MSE) Mean Squared Error
Of an estimator it's a procedure for estimating an unobserved quantity which determines the average of the squares of the errors, which is, the average squared distinction among the estimated values and what is estimated. MSE consider as risk function, corresponding to the proposed value of the squared error loss. MSE is always a positive and not zero, MSE is always non-negative, values closer to the zero are better.

(MAE) Mean Absolute Error
Is a measure of variation between two continuous variables? Mean Absolute Error (MAE) consider as the average vertical distance between every point and the Y = X line, which is also known as the One-to-One line. It's also the average horizontal distance among each point and the Y = X line,

(PSNR) Peak Signal to Noise Ratio
Is term for the ratio between the maximum potential power of a signal and the power of corrupting noise which affects the accuracy of its representation? Because several signals have a very high dynamic range, PSNR is often expressed in code of the logarithmic decibel scale,

Related Previous Study
In 4 Rounding the Intensity Followed by Division (RIFD), this lossy algorithm attempts to remove or minimize the information redundancy involved into the images while preserving its recognized visual quality and matching to the original one. The only obstacle of this technique is there will be some accuracy loss and some trivial distortions could not be rejected, but as one of lossy compression algorithms, its produces an acceptable distortion in different imaging applications because a slight loss in the image is not distinguished by the human eye. The RIFD algorithm's main idea depends on two facts, which are: Neighbouring pixels are very similar or correlated and human eye capability to realize a very fixed number of intensities allows the image to be more compressed by increasing the information redundancy that will be not detected.
This technique called RIFD, because it is rounding the Intensity Followed by Division. It contained of two fundamental steps: Rounding and dividing, the main idea of the RIFD algorithm is to check all the pixels and convert them into a number divisible by ten. After rounding and dividing the outcome is always allocated between 0-9whichnarrows the range of pixel values and is symbolized by 5 bits rather than 8 bits 4 .
In 11 proposed Five Modulus Method (FMM), which is a novel approach of image compression depend on an algorithm named Five Modulus Method, this method contained of rounding the pixels values to a divisible by five, next stage after dividing is transforming every pixel value in an 8 × 8 block, new values that are 6-bit length for every pixel and it is lower in storage area than the original value that is 8-bits. Then a new protocol for compression of the recent values as a stream of bits has been offered which gives the opportunity to store and transmit the new compressed image simply.
The advantage of FMM method is the high PSNR, even though it's low compression ratio. This technique is suitable for bi-level images like black and white medical images, where the pixel in images as this, is represented by one byte. The FMM algorithm cannot be utilized as a standalone algorithm because of its low compression ratio but it could be used as a scheme embedded into other compression method like JPEG to decrease compression ratio 11 .
In 12 a new technique to support the quality of compressed images while keeping the compression ratio Vol 12 (20) | May 2019 | www.indjst.org through adding some of pre-processing steps before performing any standing lossy compression technique. The new technique based on decreasing the minimum elements from the image pixels values in every: row, column, and 2 × 2 block, respectively. Those steps minimize the demand number of bits to represent every pixel in the compressed images. In order to confirm the efficiency of the suggested technique, two lossy compression mechanisms were implemented with the proposed technique. They performed on broad range of well-known images with several dimensions, types and sizes.
So MDT suggested adding lossless steps, to preserve the values of the largest number of pixels before running the lossy compression process in order to focus on quality and improve efficiency standards. Also it uses many loops to apply the technique.
The experimental results display that the quality of the decompressed images with the suggested technique were supported in terms of: (MSE), (MAE) and (PSNR) as quality evaluation metrics 12 .
In 13 , explained that Image compression is to minimize the number of bits of image file without corrupting the quality of the image to an acceptable level. The deterioration of compound image or record compression relay on the capacity and connivance of the files. The suggested model has two methods used for compression process which is optimal Harr wavelets and (MHE) Merging Huffman Encoding procedure. Discrete Wavelet Transform-Harr wavelet coefficient optimization analysis supported Oppositional relay Grey Wolf Optimization (OGWO). After that the compression strategy module relay encryption is performing. From the results accomplished the highest Compression Ratio for a compound image which is 97.56% matched with existing systems and furthermore estimated (MSE), (PSNR) and Compression Size of all testing images 13 .
In 14 , presents advance robust hybrid multiple watermarking method utilizing fusion of (DCT) Discrete Cosine Transforms, (DWT) Discrete Wavelet Transforms and (SVD) Singular Value Decomposition instead of performing DWT, SVD and DCT separately or combination of DWT-SVD/DCT-SVD. For recognition authentication objectives several watermarks are attached into the same medical image simultaneously, that supply excellent level of security with reasonable execution in terms of robustness and imperceptibility. In the embedding procedure, the cover image is decomposed into first level Discrete Wavelet Transforms where the approximation/lower frequency sub-band is converted by DCT and SVD. The watermark image is too transformed by DCT, DWT and SVD. The S vector of watermark data is embedded in the S elements of the cover image. The watermarked image is produced by inverse SVD on altered S vector and original U, V vectors then tracked by inverse DCT and inverse DWT. The watermark is removed utilizing extraction methods. Moreover, the text watermark is adding at the next level of the D (diagonal sub-band) of the coating image. The protection of the text watermark treat as EPR (Electronic Patient Record) information is supported by utilizing encryption technique before embedding into the cover. The outcome is acquired by varying the obtained factor, the size of text watermark, cover medical images. The technique has been extensively examined and analyzed through recognized attacks and is found to be presenting superior execution for robustness, capacity and minimized storage and bandwidth demands compared to reported methods proposed by other authors 14 .

Methodology
The proposed method aims to reduce the domain of the pixel to the half. This will support the rounding technique to reduce the repetition; the followed phase will be applying one of the rounding methods to decrease the bit depth and the redundancies, intending finally to get both significant compression and quality. The proposed process is considered lossless procedure and will be referred to as Reducing Pixel Range (RPR).
After applying both RIFD 5 and FMM 15 techniques on the same set of images, both techniques showed effective pixel values repetition reducing. Unlike RIFD which achieved higher compression ratio, FMM showed less error calculations with lower compression ratio. Therefore, the current research will attempt to improve the quality and reduce the image distortion after been processed by the lossy technique RIFD while preserving image compression rates. The results will be rated using image quality metrics (MSE, MAE and PSNR) 15 .

Proposed Algorithm
The input of the technique will be various images with different types and dimensions, each type will be handled Vol 12 (20) | May 2019 | www.indjst.org as necessary within the same phases and the output will be the de-compressed image and a table of measurements.
• Determine the maximum pixel value • Calculate the value of half pixel range, .
• Calculating the compression ratio.

Decompression Part
• Reversing the RIFD. In case of a grayscale image that each pixel is represented by 8-bits despite of its dimensions, the range of expected pixel values inside this image lay between 0 →255. When applying the RPR algorithm the half pixel value of this image is 127.5 and because most of the images are unsigned integers, this number will be rounded to 128. Next step will be to search inside the image pixels for the values between (128 and 255) to be reduced by 128.The resulted pixels will ranged within 0 →127 instead of 0→255.
This doesn't mean necessary that half of the image pixels was affected by this operation because it depends on the pixel occurrence probability of for the values that fulfil the condition of reducing.
The following Figures 1-3 of 5 × 5 matrix will display different not all possible cases and the percentage of pixels that the proposed method will affect them.

Implementation and Results Discussion
The implementation was achieved using MATLAB application for Windows v.R2018a. A set of various images with various dimensions were chosen for the Figure 1. 20% will be modified. Figure 2. 60% will be modified. experiments 16 . Those images can be classified into three groups: Grayscale images (bit-depth 8 bit), grayscale images (bit-depth 16 bit) and colour RGB images (bitdepth 24 bit). MATLAB built-in functions were used for calculate the quality metrics.

Experiments on (grayscale 8 bit-depth) Images
Experiments were made to test the proposed technique on 8 bit-depth grayscale images. First step was applying the RIFD compressing technique on number of images and the results were as shown in Table 1.
After adding the RPR steps before the RIFD, the results were as shown in Table 2. Table 3 shows the calculated overall improvement percentage, which showed a noticeable progress.
According to the comparison in Table 3, the progress after using RPR technique with RIFD compression varied as follow: MSE (41% -86%) MAE (38% -84%) PSNR (6% -22%) The qualification was acceptable and matched regarding the subjective comparison; this can be presented in the examples shown in Figure 4.

Experiments on (Grayscale 16 Bit-depth) Images
Further experiments were performed on 16 bit-depth grayscale images to validate the proposed process on higher pixel depth, after applying RIFD the quality metrics were as shown in Table 4.
The effectiveness of RPR technique on the quality used with RIFD is shown in Table 5.
When comparing the results for multiple iterations, a confirmed progress was obtained that is presented in Table 6.

Experiments on (Colored RGB 24 Bitdepth) Images
A new challenge was deploying the proposed technique on a multi-layer image. Therefore, set of RGB colour space images were chosen for testing the proposed technique. With the same sequence as above, RIFD has been implemented first and obtained the following values shown in Table 7.
After applying RPR along with RIFD, the results were as shown in Table 8.    When verifying the results of the RGB images, there was less improvement when using the proposed technique compared to the previous types of images.
The slight improvement after using the proposed technique on the RGB is shown in Table 9.

Discussion
Where most lossy techniques focus on increasing the compression ratio and reduce the compression time, this research aimed to find an approach that will enhance the quality of a lossy technique without affecting its important characteristic of the high compression ratio. RIFD5 a lossy compression technique was chosen to improve its quality     Experiments also were performed on 16 bit-depth grayscale images to validate the proposed process on higher pixel depth, after applying RIFD, results proved. The effectiveness of RPR technique on the quality used with RIFD 5 , after comparing the results for multiple iterations, a confirmed progress was obtained, the improvement after using RPR technique along with RIFD on 16 bit-depth images was varied as show: MSE (41% -99%) MAE (40% -99%) PSNR (5% -85%) Results showed high percentage of better results 11 . Experiments on (Colored RGB 24 bit-depth) images were implemented with the proposed algorithm 17 . When verifying the results of the RGB images, there was less improvement when using the proposed technique compared to the previous types of images. The slight improvement after using the proposed technique on the RGB as showing: MSE (1% -22%). MAE (0% -11%). PSNR (0% -3%). While the proposed technique in this study showed marked improvement calculated through using three objective quality metrics and succeeds to sustain the compression ratio, this progress was obvious on all the tested images.

Conclusion
This study aimed to contribute to the development of compression methods and find appropriate solutions for higher efficiency and better quality of image compression. The results proved the ability of the proposed method to improve image quality compressed by a lossy technique without affecting the compression ratio, which has been achieved by using a small-sized index to retrieve data to the image in the decompression process. Results show that this progress was obvious on grayscale images with 16 bit-depth followed by 8 bit -depth images with completely preserving the compression ratio for both images group. Reduce the domain of the pixel to the half will support the rounding technique to reduce the repetition, next phase will be applying one of the rounding methods to decrease the bit depth and the redundancies, intending finally to get both significant compression and quality .
The study demonstrated the ability to optimize the grey scale images significantly especially the in high depth images, and the improvement was slightly in color images.

Future Work
A future investigation can find the reason for the ineffectiveness of the proposed method when implemented on color images, although it showed a clear improvement in other types of grayscale images and whether it's possible to improve other lossy techniques.