COMPARATIVE STUDY ON THE IMAGE COMPRESSION OF PHOTO SHARING SITES USING MEAN SQUARE ERROR, PEAK SIGNAL TO RATIO AND DATA-RATE SAVINGS

1GIMA S. BATINGGAL, MIT, 2JASMIN D. NIGUIDULA, DT

1Colegio de San Juan de Letran-Calamba Bucal, Calamba City, Philippines 2Technological Institute of the Philippines-Manila Manila, Philippines E-mail: [email protected], [email protected]

Abstract- Nowadays, lots of people are very enthusiastic when it comes to sharing of photos in social media sites or photo sharing sites (Madden, Lenhart, Cortesi, Gasser, Duggan, Smith and Beaton, 2013). However, it is observed that when photos are uploaded the qualities of the pictures were reduced. This study evaluated the image compression of various sites using mean square error (MSE), peak signal-to-noise ratio (PSNR) and data-rate savings to determine which site will produce a better quality picture and allocates lesser memory space. The results attained from this study showed that there are several photo sharing sites that gave out zero noise in image downloading and uses high data-rate saving.

Keywords- Netizens, reconstructed image, noise, dimension, bits per pixel

I. INTRODUCTION used on the Web. All you need is a MIME type, so that the format is labeled correctly for transfer across According to Merriam Webster, “social media site is the Web.” Moreover, Facebook Help Center only a form of electronic communication”. It was used for supports certain types of image formats and it social networking and micro blogging. Netizens recommends using .jpg, .bmp, .png, .gif and .tiff create communities online to share information and files. However, Hill (2013) stated that “.tiff files are other contents like pictures and videos. huge and take forever to upload. That is why Consumer psychologist Dr. Leah Tierney (2015) said uploading .tiff is not worth the effort”. people around the world are indulge in sending Furthermore, the study does not discuss how the messages in Tweeter, sharing information and life image compression algorithm works on these sites experiences on Facebook, current adventures on since the developers of the sites did not disclose Instagram, and uploading and downloading concrete data about their image compression numerous videos on Youtube. In line with this, Dr. algorithm. Text, audio and video are also not part of Tierner found out five main reasons why people this study due to time constraints. behave the way they do. These includes: (1) to The result of this study can be used as reference in express one’s identity; (2) to build rapport; (3) for an understanding the level of and data-rate incentive; (4) to feel a sense of belonging; and (5) to saving found in the image compression of various advocate great content”. photo sharing sites. However, this doesn’t give the people knowledge on which social media sites or photo sharing sites will II. LITERATURE REVIEW provide better quality pictures and will allocates lesser memory space. For this reason, the researchers “Image compression is an application that reduces would like to evaluate the image compression of the size of an image in bytes”. The reduction in file various photo sharing sites by means of mean square size allows extra amount of memory space and error (MSE), peak signal-to-noise ratio (PSNR) and minimizes the time needed for pictures to be sent or data-rate saving. downloaded from World Wide Web (Bose, To identify which site to include in this study, the Madhulika, & Acharjee, 2014). researchers considered the best and most popular As regards to compression technique or compression photo sharing websites. According to algorithm, this actually refers to compression and TrendingTopMost.com, AllTop9.com, reconstruction algorithm. According to Sayood Techlicious.com and Tomsguide.com, the most (2006), “the compression algorithm takes an input X popular photo sharing sites include Facebook, and produces a representation Xc”. While the Instagram, Imgur, Flickr, Photobucket, Shutterfly, “reconstruction algorithm operates on the SmugMug, Zenfolio, GooglePhotos and Tumblr. compressed representation Xc to generate the Concerning image format, the researchers decided to reconstruction Y.” Compression algorithm can be use JPG, GIF, PNG and BMP. According to classified as lossless or lossy compression. Lossless www.w3c.org, “there is no limit in the Web compression “guarantees full reconstruction of the specifications as to the graphical formats that can be

Proceedings of Academics World 63rd International Conference, Manila, Philippines, 28th-29th April 2017 13 Comparative Study on The Image Compression of Photo Sharing Sites Using Mean Square Error, Peak Signal to Noise Ratio and Data-Rate Savings original data without incurring any distortion in the 3.2 Performance Evaluation Parameters process”. On the other hand, lossy compression 3.2.1 Data-Rate Saving involves losses of some information from the original Data-rate saving metric is a measurement to know data (Asolkar, Zope, Suralkar, 2013). the amount of storage reduced after an image On the other hand, according to MathWorks.com, compression. there are two kinds of quality metrics for image. The equation for data-rate saving is: These are peak signal to noise ratio or PSNR and Data-rate saving = 100 – (1- B1 / B0) structural similarity or SSIM index. “PSNR is simple Where to calculate but sometimes does not align well with B0: refers to the file size of the original picture perceived standard quality” while “SSIM is based on B1: refers to the file size of the reconstructed picture the principle that the human visual system is good For example: for extracting information based on structure”. If B0 = 80.4 KB and B1 = 30.4 KB then In addition, Huynh-Thu and Ghanbari (2012) have shown that “PSNR can be a valid quality measure if the data content and the codec type are not changed”. Table 1 shpows the number of colors in an image according to the number of bits per pixel based onTutorialspoint.com. 3.2.2 PSNR and MSE PSNR is a metric for comparing the reconstructed image of different image compression algorithms. According to National Instruments (2013), “PSNR refers to the ratio between the maximum possible value (power) of a signal and the power of distorting noise that affects the quality of its representation”. Different image compression algorithm can be compared scientifically using the same test image to determine which algorithm produces better results. The formula for PSNR is:

Table 1. Number of Colors in an Image According PSNR = 20 log10 Maxf /√MSE to Bits per Pixel Where, MAXf refers to the maximum signal value present in III. METHODS the original image. For example, if the test data is an 8-bit image, then Maxf value is 255 since the color 3.1 Data Acquisition for 8-bit image are 0 to 255. Take note that these The experiment started with uploading and values have its corresponding color representation. downloading of 8-bit pictures in the photo sharing MSE is a measure of level of distortion of the sites. The dimension of each downloaded images are reconstructed image from the original image. identified to know if the site is qualified for the The equation for MSE is: m-1 n-1 experiment. Instagram.com was excluded from this study, because the dimension of the original test data 1 ∑ ∑ || f(i,j) – g(i,j) ||2 MSE = mn or image is not equal to the downloaded image. Where 0 0 The researchers acquired the RGB values in the f is the array of data in the original image; picture using a java program. They used getWidth() g is the array of data in the reconstructed image; and getHeight() methods to get the width and height i refers to the index of each row in the 2D image; of an image. The values of width and height were j is the index of each column in the 2D image; used in defining the length of the 2D image. Also, m refers to the total number of vertical pixels in the they applied the image.getRGB() method to get the 2D image and red, green and blue (RGB) on every elements of the n is the total number of horizontal pixels in the 2D 2D image. image.

Figure 1. Screenshot of a Java Program that Gets the RGB values of an Image

Proceedings of Academics World 63rd International Conference, Manila, Philippines, 28th-29th April 2017 14 Comparative Study on The Image Compression of Photo Sharing Sites Using Mean Square Error, Peak Signal to Noise Ratio and Data-Rate Savings On the other hand, a sample data were presented Figure 3 shows that Facebook.com has the highest below to show how to compute the PSNR and MSE data-rate saving based on its value of 90%. However, using the RGB values in Table 2 and Table 3. Imgur.com, Flickr.com, Photobucket.com, First, get the summation of difference between the SmugMug.com, GooglePhotos.com and Tumblr.com original and reconstructed image. have 0% data-rate saving since its file size does not change after reconstruction. The PNG file is not supported in Shutterfly.com.

Second, compute the average of mseRed, mseGreen and mseBlue.

Third, multiply the mseAverage to 1. Then divide the product to the product of m and n, where m is the number of vertical pixels and n is the number of Figure 3. Data-Rate Saving of the Test Data in PNG Format horizontal pixels. Figure 4 shows that Facebook.com has the highest data-rate saving based on its value of 78%. However, Imgur.com, Flickr.com, Photobucket.com, SmugMug.com, GooglePhotos.com and Tumblr.com Last, If MAXf is equal to 255 (using 8-bit image) have 0% data-rate saving since its file size does not then change after reconstruction. The GIF file is not supported in Shutterfly.com.

3.3 Interpretation The interpretation of the result is supported by what is stated in the literature - the higher the data-rate saving, the higher the data loss; the higher the mean square error, the higher the noise or error; and the higher the PSNR value, the greater the image compression used.

IV. RESULTS AND DISCUSSIONS

Figure 4. Data-Rate Saving of the Test Data in GIF Format The following figures and table provides the statistics and comparison of all photo sharing sites according Figure 5 shows that Facebook.com has the highest to data-rate saving, MSE and PSNR values. data-rate saving of 93% while GooglePhotos.com has Figure 2 shows that Imgur.com has the highest data- the lowest data-rate saving of 0%. rate savings based on its value of 66%. However, Flickr.com, Photobucket.com, Shutterfly.com, SmugMug.com, GooglePhotos.com and Tumblr.com have 0% data-rate savings since its file size does not change after reconstruction.

Figure 5. Data-Rate Saving of the Test Data in BMP Format

Table 4 shows the MSE and PSNR of the reconstructed images from various photo sharing sites. Based on its MSE value for JPG format, results Figure 2. Data-Rate Saving of the Test Data in JPG Format have shown that apart from Facebook.com and

Proceedings of Academics World 63rd International Conference, Manila, Philippines, 28th-29th April 2017 15 Comparative Study on The Image Compression of Photo Sharing Sites Using Mean Square Error, Peak Signal to Noise Ratio and Data-Rate Savings Imgur.com, the remaining sites did not produce lower than the other site, therefore the MSE value is noise. also lower than the other site. If the data-rate saving As for the PNG and GIF files, among the 8 sites only of a site is high then the level of noise in the the downloaded image from Facebook.com produced reconstructed image is also high. In addition, it was noise. observed that the photo sharing site with the highest For the BMP file, the downloaded images from distortion or noise base on its MSE value have low Photobucket.com and GooglePhotos.com. have zero PSNR value. For these reason, the researchers MSE value (noise). concluded that MSE is indirectly proportional to the value of peak signal-to-noise ratio (PSNR). If a site has low MSE value, you can expect that this site has high PSNR value. Thus, if a site has high MSE value, therefore the quality of image representation is low. In summary, no photo sharing site can provide better quality pictures without sacrificing the time it takes to upload and download pictures because as what the researchers concluded earlier, the data-rate saving is directly proportional to MSE and MSE is indirectly proportional to PSNR.

REFERENCES Table 4 Summary Results of Computed PSNR and MSE using the downloaded images from various Photo Sharing Sites [1] Asolkar, P., Zope, P., and Suralkar, S. 2013. Review of Data Compression and Different Techniques of Data Compression. Figure 6 shows among Facebook.com, Imgur.com International Journal of Engineering Research and Technology, and Flickr.com, when using BMP format, Imgur.com Page 1-2. has better image compression based on its PSNR [2] Baguley, R. n.d. The 10 Best Photo Syorage and Sharing Sites. Retrieved January 5, 2017, from value of 37.4db and MSE value of 11.8db. It is also http://www.tomsguide.com/us/pictures-story/839-best- evident in the figure that Flickr.com has the largest photography-sites.html#s14 distortion level of 36db compared to Imgur with [3] Techlicious. n.d. Best Photo Sharing Sites. Retrieved January 5, 2017, from http://www.techlicious.com/guide/best-photo- 11.8db and Facebook with 35.7db. sharing-sites/ [4] Bose, S., Madhulika, H., and Acharjee, S. 2014. Effects of Watermarking in Vector Quantization Based Image Compression. Institute of Electrical and Electronics Engineers, ISBN: 978-1-4799-4190-2. DOI: 10.1109/ICCICCT.2014.6993014. Page 1-2. [5] Center, I. H. n.d. Privacy Policy Important Update. Retrieved December 6, 2016, from https://www.instagram.com/about/legal/privacy/ [6] Collet, Y., & Turner, C. n.d. Smaller and Faster Data Compression with Zstandard. Retrieved December 6, 2016, from https://code.facebook.com/posts/1658392934479273/smaller- and-faster-data-compression-with-zstandard/ [7] Hill, L. 2013. Can you upload tiff files to Facebook? Retrieved Figure 6. Computed MSE and PSNR of Downloaded December 5, 2016, from Images in BMP Format https://www.dpreview.com/forums/post/50898632 [8] Huynh-Thu, Q., & Ghanbari, M. 2012. The Accuracy of PSNR in Predicting Video Quality for Different Video Scenes and CONCLUSION Frame Rates. Telecommunication System, Page 1-2. [9] Lasya, K. n.d.. Best 2 + Top Photo Sharing Sites List 2016. The study showed how to compare various photo Retrieved December 5, 2016, from sharing sites using the equation of peak signal to http://www.alltop9.com/best-photo-sharing-sites-list-2016/) [10] Li, Z., and Drew, M. 2004. Fundamentals of Multimedia. US: noise ratio and mean square error to determine Pearson Education Inc. which site provides better quality picture. It also [11] MathWorks. n.d. Retrieved December 6, 2016, from showed how to determine which site has better https://www.mathworks.com/help/images/image-quality- metrics.html. compression rate through data-rate saving equation. [12] Merriam Dictionary. n.d. Retrieved December 7, 2016, from Base on the data, there are sites with better image https://www.merriam-webster.com/dictionary/social%20media. quality representation based on its MSE value of 0db [13] Mu, W., Gao, J., Jiang, H., Chen , F., Gao, Z, and Chen, K. 2013. Measuring Technology and Mechatronics Automation. however these sites also have 0% compression rate Fifth International Conference, DOI: base on its data-rate saving value. For these reasons, 10.1109/ICMTMA.2013.19. Page 1-2. the researchers concluded that the data-rate saving of [14] Myers, L. 2014. How to Optimize Photos for Facebook. Retrieved December 5, 2016, from a compressed image is directly proportional to the http://louisem.com/1730/how-to-optimize-photos-for-facebook value of MSE. If the data-rate saving of a site is

Proceedings of Academics World 63rd International Conference, Manila, Philippines, 28th-29th April 2017 16 Comparative Study on The Image Compression of Photo Sharing Sites Using Mean Square Error, Peak Signal to Noise Ratio and Data-Rate Savings [15] National Instruments. 2013. Retrieved December 5, 2016, from [20] TrendingTopMost. 2017. Top 10 Most Popular Best Photo http://www.ni.com/white-paper/13306/en/ Sharing Websites 2017. Retrieved January 10, 2017, from [16] Prabhu, B. 2013. PSNR Analysis for MDC Based Video http://www.trendingtopmost.com/worlds-popular-list-top- Streaming Over Peer-to-Peer Networks. International Journal of 10/2017-2018-2019-2020-2021/best-blogs-websites/best- Scientific and Research Publications, ISSN 2250-3153. photo-sharing-websites-free/ Volume 3. Page 1-2. [21] Tutorialspoint. n.d. Concepts of Bits per Pixel. Retrieved [17] Sayood, K. 2006. Introduction to Data Compression. San December 6, 2016, from Fransisco, CA 94111: Elsevier. https://www.tutorialspoint.com/dip/concept_of_bits_per_pixel. [18] Sonka, M., Hlavac, V., and Boyle, R. 2015. Image Processing htm Analysis and Machine Vission 4th Ed. US: Cengage Learning [22] Veldhuizen, K. 1998. Retrieved December 5, 2016, from Inc. http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/ [19] Tierney, L. 2015. The Psychology Behind Why We Share on VELDHUIZEN/node18.html Social Media. Retrieved December 5, 2016, from [23] W3C.org. n.d. Graphics. Retrieved December 7, 2016, from https://www.shutterstock.com/blog/the-psychology-behind-why- https://www.w3.org/Graphics we-share-on-social-media



Proceedings of Academics World 63rd International Conference, Manila, Philippines, 28th-29th April 2017 17