MVnet logo

Tutkielmat » Yliopisto » Image compression

  • Julkaistu: 08.03.2008
  • Päivitetty: 14.02.2011
  • Kommentit
Multimediatekniikan harjoitustyö kuvakompressiosta (englanniksi)
Tehty: 10.4.2007 Arvosana: Erinomainen
Sivuja: 32 kpl Sanamäärä: 7200
Tekijä: Mikko Vestola

Table of contents

Image compression

Briefly in English: This exercise was part of the course T-111.2350 Multimedia Technology in Helsinki University of Technology. The topic of the work was chosen from the topic list available on the course web page. I chose the topic image compression where the task was to learn the basics about digital image processing, study compression techniques and analyse the properties of different formats (video compression was also part of the task but I did the image compression part which is presented here). The exercise was divided into three parts: preliminary report, work plan and final report. The work was graded at the following scale: failed, passed or excellent (+1 to grade of exam). This work got grade "excellent". It might take some time to load this page because of the large images.

Lyhyesti suomeksi: Tässä esitetty harjoitustyö oli osana Teknillisen korkeakoulun kurssin T-111.2350 Multimediatekniikka suorittamista. Työn aiheen sai valita melko vapaasti ennalta määrätyistä aiheista, jotka löytyvät kurssin kotisivuilta. Itse valitsin kuvakompression, jossa tehtävänä oli opetella perusteet kuvakompressiosta ja analysoida eri formaattien hyviä ja huonoja puolia (tehtävään kuului myös videokompressio, mutta itse tein kuvakompressio-osan, joka on siis esitetty tällä sivulla). Tehtävän palautus oli jaettu kolmeen eri osaan: esiselvitys, työsuunnitelma ja raportti. Työ arvosteltiin asteikolla: hylätty, hyväksytty tai erinomainen (+1 tenttiarvosanaan). Tämä harjoitustyö sai siis arvosanan erinomainen. Sivun lataaminen saattaa kestää hieman kauemmin isojen kuvien vuoksi. Huom! Harjoitustyön kieli on englanti.

Introduction: Preliminary report

The purpose of image compression is to represent images with less data in order to save storage costs or transmission time. Without compression, file size is significantly larger, usually several megabytes, but with compression it is possible to reduce file size to 10 percent from the original without noticeable loss in quality. Image compression can be lossless or lossy. Lossless compression means that you are able to reconstruct the exact original data from the compressed data. Image quality is not reduced when using lossless compression. Unlike lossless compression, lossy compression reduces image quality. You can't get the original image back after using lossy compression methods. You will lose some information. [1]

Lossless image compression is usually used in artificial images that contain sharp-edged lines such as technical drawings, textual graphics, comics, maps or logos. This is because lossy compression methods produce compression artifacts to images and sharp-edged lines become fuzzy especially when using strong compression. Instead, lossy compression is a good choice for natural images such as photos of landscapes where minor loss on sharpness is acceptable to achieve smaller file size. With the naked eye it is very hard to see any differences between uncompressed natural image and one with compressed by lossy methods if the compression is not too strong. [3]

The most widely used methods of lossless compression in images are run-length encoding (RLE), entropy coding and dictionary coders. RLE is just representing long sequences of same data by shorter form. For example AAAAAAABBBBCCCCC can be expressed as 7A4B5C. Entropy encoding assigns codes to symbols so that symbols that occur most frequently take the shortest codes. The most common entropy encoding technique is Huffman coding. Dictionary coders build a table of strings and then replace occurrences of them by shorter codes. The LZW (Lempel-Ziv-Welch) algorithm is perhaps the most used dictionary coder and it is used for example in GIF and ZIP file formats. [1-9]

Lossy compression is usually based on techniques by removing details that the human eye typically doesn't notice. Digital images are composed of pixels that represent color information. When a pixel differs only slightly from its neighbors, its value can be replaced theirs. This will lose some information but it is usually barely noticeable with human eye if the algorithm is good enough. After this e.g. RLE or Huffman coding can be used to compress data. Mostly used lossy compression method is transform coding such as discrete cosine transform (DCT, used in JPEG) or wavelet transform (used in JPEG 2000). Other popular methods are color quantization (reducing the color space) and chroma subsampling. These methods are based on a fact that the human eye is more sensitive to luminance than color, so file size can be optimized by storing more luminance detail than color detail. Also fractal compression is used but it's not so popular. [1-3] [10]

There are various image formats that implement these compression methods differently. Some of them use only lossless compression and some of them use both lossless and lossy methods or no compression at all. Most common image formats are the following: BMP, JPEG, GIF, PNG and TIFF. [11]

BMP is an uncompressed image format used in Windows and it eats lots of space. JPEG is the most widely used image format that uses lossy compression methods such as DCT and chroma subsampling. It also uses lossless methods such as RLE and Huffman coding but it doesn't actually allow to save in lossless format. JPEG is especially good for natural images. [12] [13]

GIF uses lossless compression algorithm LZW. So it reduces the file size without degrading the visual quality. But GIF allows only to use 256 colors so it is not suitable for natural photographs which consist from millions of colors. However, quality can be enhanced by using color dithering. GIF is especially good for artificial images that contain sharp-edged lines and few colors. The compression algorithm that GIF uses was patented in 1985 and the controversy over the patent licensing led to development of the PNG image format. PNG uses also a lossless compression called DEFLATE that uses a combination of the LZ77 dictionary coder and Huffman coding. PNG offers better compression and more features than GIF but it doesn't support animation that GIF does. PNG allows to use millions of colors in pictures. [14-18]

TIFF format is a flexible and adaptable file format. It can store multiple images in a single file. You can choose which compression algorithm to use. TIFF can be used as a container for JPEG or you can choose to use lossless compression such as RLE or LZW. Because TIFF supports multiple images in a single file, multi-page documents can be saved as single TIFF file rather than as a series of files for each scanned page. [19]

There is also a newer version of JPEG called JPEG2000 which also supports lossless compression. It's lossy wavelet algorithms produce slightly better image quality than JPEG (up to 20 per cent plus) but it's not widely used because of some patent issues. Microsoft has also developed "a new generation" image format called HD Photo (formerly Windows Media Photo). Microsoft claims that HD Photo offers a perceptible image quality comparable to JPEG 2000 and produces images more than twice the quality of JPEG. [20-22]

There are also SVG graphics which are used to create vector graphics. It is not actually a compression algorithm but it's an XML based markup language. Instead of specifying the color of every pixel as in raster graphics (JPEG, GIF, PNG), SVG uses mathematical expressions to specify coordinates of shapes. SVG images can be extremely small. The image is also scalable because it is vector-based, so you can enlarge the image and it will still look great. [23]

References:

  1. http://search.eb.com/eb/article-9002216 (only accessible in TKK's domain)
  2. http://www.maximumcompression.com/algoritms.php
  3. http://en.wikipedia.org/wiki/Image_compression
  4. http://en.wikipedia.org/wiki/Run-length_encoding
  5. http://en.wikipedia.org/wiki/Entropy_coding
  6. http://en.wikipedia.org/wiki/Huffman_coding
  7. http://www.huffmancoding.com/david/algorithm.html
  8. http://en.wikipedia.org/wiki/Dictionary_coder
  9. http://en.wikipedia.org/wiki/LZW
  10. http://en.wikipedia.org/wiki/Color_quantization
  11. http://en.wikipedia.org/wiki/Comparison_of_graphics_file_formats
  12. http://en.wikipedia.org/wiki/JPEG
  13. http://www.impulseadventure.com/photo/jpeg-compression.html
  14. http://en.wikipedia.org/wiki/GIF
  15. http://www.w3.org/Graphics/GIF/spec-gif89a.txt
  16. http://www.cis.udel.edu/~amer/CISC651/lzw.and.gif.explained.html
  17. http://en.wikipedia.org/wiki/PNG
  18. http://www.w3.org/TR/2003/REC-PNG-20031110/
  19. http://en.wikipedia.org/wiki/Tagged_Image_File_Format
  20. http://en.wikipedia.org/wiki/JPEG_2000
  21. http://www.jpeg.org/faq.phtml?action=show_answer&question_id=q3d5bc0701c9b6
  22. http://www.microsoft.com/whdc/xps/wmphoto.mspx
  23. http://en.wikipedia.org/wiki/Scalable_Vector_Graphics

Work plan: Comparing and analyzing different image formats

I am trying to compare how effective are the different JPEG2000 implementations and compare them to their predecessor JPEG and also to Microsoft's HD Photo (aka. Windows Media Photo, WMP). Implementations of JPEG2000 I chose to compare are the following:

  • LuraWave IrfanView PlugIn v3.95 (commercial implementation of JPEG2000, used by popular IrfanView image viewer/editor)
  • Jasper v1.900.1 (perhaps the most widely used non-commercial implementation of JPEG2000, used for example in KDE, XnView and Photoline 32)
  • BOI v1.2 (novel Java-based and non-commercial implementation of JPEG2000)

I'm interested to find out that is there a big difference between these commercial and non-commercial implementations of JPEG2000. So is there any big benefit to put money on JPEG2000 implementation and so, should IrfanView perhaps consider using these non-commercial versions of JPEG2000 implementations (IrfanView's LuraWave plugin is restricted to images less than 640 x 480 resolution and you must pay if you want to save larger images). In MSU JPEG 2000 Image Codecs Comparison LuraWave was one of the best implementations of JPEG2000 and Jasper (v1.701.0) was one of the worst. BOI was not tested in that test. So I'm also interested to find out is Jasper developed since that (newest version is v1.900.1) and does this new BOI implementation do well.

I will also compare these different JPEG2000 implementations to HD Photo and to JPEG. I'm also especially interested to find out that are these non-commercial JPEG2000 implementations significantly better than HD Photo (and is HD Photo so good as Microsoft claims). I think it is useful to include JPEG to comparison because it is still widely used, so it would act like a baseline to see how much these new implementations have improved.

Comparison is done by saving different types of images to these image formats (using only lossy compression). Images I chose to deal with are the following (most of them are standard test images from The USC-SIPI Image Database or Kodak test images):

  • Mandrill (aka. Baboon) (Color image with lots of details - fur and whiskers. It is said to be hard to compress because it contains a great variation of color and a large amount of texture. [1] )
  • Barbara (Color image with many stripes. Basic human face and skin.)
  • Girl (Lena or Lenna) (Classical test image. Smooth color changes, borders.)
  • Lighthouse (Color image with many details like fence and hand-rail on top of the lighthouse. Also showing natural sky.)
  • Ruler (Artificial image with both text and lines)

I save these all images first to uncompressed BMP format. After that I save these images to JPEG and use four different compression levels (100, 80, 50, 20). After that I compress these images to JPEG2000 and WMP trying to compress such that the file sizes are equal. Compressing to JPEG and LuraWave's implementation of JPEG2000 I use IrfanView (version 3.99) and a plug-in pack (also version 3.99) which adds support to JPEG2000. Compressing to Jasper and BOI I use command-line tools found at their websites. Compressing to WMP I use a command line tool called The Windows Media Photo Device Porting Kit (DPK). With that I can compress BMP files to WMP and WMP files to BMP.

After I have compressed these images to different formats I will do a subjective evaluation of their image quality (give some rough ratings to images). After that I compare the image quality objectively. For this comparison I use a program called MSU Quality Measurement Tool. It can compare image quality using different metrics (PSNR, MSE, MSAD, SSIM, VQM etc.). I decided to compare using metrics PSNR and SSIM (and find out if there is a big difference between these metrics based on my subjective evaluation). MSU QMT gives ratings for image quality. I compare these ratings, and my subjective evaluations and make some conclusions and nice graphs with OpenOffice. I also thought to use these "difference visualization images" (like in this page) which can be produced with MSU QMT.

Saving to different types of formats doesn't take so much time but I think that analyzing and reporting the quality of images would take more time. Also learning to use these programs take some time.

References:

  1. http://www.cs.mu.oz.au/~jjchua/publications/chua_tischer_ng_PCS96_quick.pdf (5. Results of testing, page 3)

Report

Codecs used in test

Codecs used in test
Codec name Codec type Developer Version Codec description
LuraWave JP2 IrfanView PlugIn JPEG2000 LuraTech 3.95 Commercial implementation of JPEG2000, used by popular IrfanView image viewer/editor
Jasper JPEG2000 Michael Adams 1.900.1 Perhaps the most widely used non-commercial implementation of JPEG2000, used for example in KDE, XnView and Photoline 32
BOI JPEG2000 Group on Interactive Coding of Images 1.2 Novel Java-based and non-commercial implementation of JPEG2000
HD Photo Device Porting Kit HD Photo Microsoft 1.0 HD Photo, also known as Windows Media Photo, is a new image file format from Microsoft. Microsoft says that "HD Photo delivers image quality that is comparable to JPEG-2000 and more than twice the quality of JPEG."
IrfanView JPEG JPEG Irfan Skiljan / Independent JPEG Group 3.99 Popular image viewer with JPEG support. IrfanView's JPEG codec is from Independent JPEG Group (version 6b of 27-Mar-1998).

Codec settings

All codecs were run on Microsoft Windows XP Professional, except Jasper which was run on Ubuntu 6.10 because installation on Windows wasn't succesfull. I used 6 different image compression levels with LuraWave: 10, 30, 50, 70, 90 and 100. 100 is the best possible quality achieved with lossy compression and 1 is the worst. Output images produced by LuraWave acted as reference images to all the other codes. Their output images were compressed so that the output image was approximately the same size as with LuraWave codec. Usage of the codecs used is descriped below. IrfanView had graphical user interface and all the other codecs were command line programs.

Usage of LuraWave JP2 IrfanView PlugIn and IrfanView JPEG:

Compression using LuraWave codec and compression to JPEG was done using IrfanView. Compression level was varied by changing the quality factor (1-100) seen in windows below. Quality factor 100 produces the best image quality and 1 worst.

IrfanView JPEG settings IrfanView JPEG2000 settings

Usage of BOI:

java -classpath BOI.jar BOI.BOICode -i baboon.bmp -o baboonComp -of 1 0 2 -tb 102400

Setting "1 0 2" after parameter "of" means that BOI produces JP2 JPEG2000 codestream header with JP2 box as all the other codecs in this test. Compression level was varied by changing the parameter "tb" (target bytes).

Usage of JasPer:

jasper -f baboon.bmp -F baboonComp.jp2 -T jp2 -O rate=0.1

Setting jp2 after the parameter T means that JasPer produces JP2 images instead of JPC. Compression level was varied by changing the rate parameter which sets the compression factor (eg. 100:1 = 0.01, 10:1 = 0.1).

Usage of HD Photo Device Porting Kit:

wmpencapp.exe -i baboon.bmp -o baboonComp.wdp -q 20

Compression level was varied by changing the quanitizion (q) parameter (1-255). The smaller the value the better the quality. Because IrfanView can't handle HDPhoto, output images were converted to BMP (for the objective comparison made with MSU Video Quality Measurement Tool) by the following command:

wmpdecapp.exe -i baboonComp.wdp -o baboonOut.bmp

Images used for test

Baboon

  • Name: Mandrill aka. Baboon
  • Uncompressed file size: 786 486 bytes
  • Resolution: 512 x 512
  • Features: Color image with lots of details - fur and whiskers. It is said to be hard to compress because it contains a great variation of color and a large amount of texture.

Barbara

  • Name: Barbara
  • Uncompressed file size: 983 094 bytes
  • Resolution: 640 x 512
  • Features: Color image with many stripes. Basic human face and skin.

Lenna

  • Name: Lenna
  • Uncompressed file size: 786 486 bytes
  • Resolution: 512 x 512
  • Features: Classical test image. Smooth color changes, borders.

Lighthouse

  • Name: Lighthouse
  • Uncompressed file size: 983 094 bytes
  • Resolution: 512 x 640
  • Features: Color image with many details like fence and hand-rail on top of the lighthouse. Also showing natural sky.

Ruler

  • Name: Ruler
  • Uncompressed file size: 786 486 bytes
  • Resolution: 512 x 512
  • Features: Artificial image with both text and lines

Rules for testing

Uncompressed BMP images were first compressed to JPEG2000 using LuraWave JP2 IrfanView PlugIn. After that, images were compressed using all the other codecs so that they produce approximately the same size of output file. All codecs parameters were set to defaults (only the the quality factor and input/output images were changed, see the "Codec settings" part).

After compression, all the compressed images were converted to uncompressed BMP with IrfanView, except that compressed HDPhoto images were converted to BMP using command line tool provided with HD Photo Device Porting Kit. This conversion must be done for the objective comparison.

Objective comparison was done by calculating the PSNR and SSIM values using MSU Quality Measurement Tool (default settings). MSU QMT produced a CSV file containing the PSNR/SSIM value and also a "difference visualization image". I wrote a small Java program that parses these PSNR/SSIM values from these CSV files, calculates the file size and saves them all in text files, which I can easily import to a program called Graph, which draws nice graphs from the results.

Objective comparison

PSNR and SSIM values were calculated with MSU Quality Measurement Tool. The higher the PSNR value (scale 0-100) the better the image quality. Same applies to SSIM values (scale 0.0-1.0).

Y-PSNR graphs

PSNR graph

Y-PSNR graph for baboon image

Baboon image: JPEG clearly beats all the other codecs when using low compression but it didn't do so well at high compression. JPEG didn't produce any bigger file size (37% was the maximum when compression level was 100). BOI did pretty well, it has pretty good quality at both high and low compression. HD Photo, Jasper and LuraWave produce quite same quality. Not so good but not so bad either. Jasper struggles a little bit at low compression and LuraWave at high compression.

PSNR graph

Y-PSNR graph for barbara image

Barbara image: BOI is clearly the best codec at all compression levels. LuraWave comes second, although it struggles at high compression. Again, JPEG doesn't perform so good at high compression. Jasper was a bit worse than HD Photo at low compression.

PSNR graph

Y-PSNR graph for lenna image

Lenna image: Again, BOI performs very well and JPEG is very good at low compression. HD Photo and Jasper are quite equal. LuraWave has big difficulties at high compression. It is even worse than JPEG, which isn't usually good at high compression.

PSNR graph

Y-PSNR graph for lighthouse image

Lighthouse image: This is an image where the difference between JPEG2000 and JPEG compression can really be seen. JPEG is definitely the worst codec here and BOI is clearly the best. LuraWave is also good but it is clearly in trouble at high compression. HD Photo and Jasper produced almost equal quality.

PSNR graph

Y-PSNR graph for ruler image

Ruler image: This is an image where you can see the most difference between the codecs. Jasper did surprisingly well. It produced images with file size of 36.7 kB. First this looks like Jasper has automatically used lossless compression because when using lossless compression the file size is 37 kB. But when analysing the PSNR values, Jasper's images had PSNR value 85.4, when the image compressed with lossless methods gets always 100. I have no idea how Jasper did this or was it using some sort of mixture of lossless and lossy compression. HD Photo was clearly the worst here and JPEG didn't do so well either.

This isn't really so important part of the test because one wouldn't usually compress these kind of artificial images with lossy compression. It would definitely be better to use lossless compression, such as PNG or lossless methods of JPEG2000. But sometimes you might come with a situation where you can't choose between lossy and lossless and you have to use lossy compression.

SSIM graphs

SSIM graph

SSIM graph for baboon image

Baboon image: Quite same results than in PSNR graph. JPEG is still the best and BOI comes second. Jasper slightly improves at low compression when LuraWave really has big problems at high compression.

SSIM graph

SSIM graph for barbara image

Barbara image: BOI is still the best but LuraWave isn't any more the second. JPEG now outperforms it at low compression and LuraWave has clearly difficulties at high compression. JPEG improves its position although it is still the worst at high compression.

SSIM graph

SSIM graph for lenna image

Lenna image: Now JPEG gets the first place from BOI when moved to SSIM from PSNR. BOI is clearly the second best and outperforms JPEG at high compression. All the other codecs were quite equal, except that LuraWave has huge problems at high compression. The quality is even perceptibly worse than JPEG.

SSIM graph

SSIM graph for lighthouse image

Lighthouse image: The difference between JPEG and JPEG2000 isn't any more so clearly seen in this graph. JPEG reaches the others and is actually better than Jasper at low compression, when it was clearly worse when measuring PSNR values. BOI is still the best. HD Photo produces quite good quality at all points and therefore gains the second place. Jasper is also good but slightly worse than HD Photo. LuraWave isn't so good any more. It is almost as bad as JPEG at high compression levels.

SSIM graph

SSIM graph for ruler image

Ruler image: The results are quite the same as in PSNR graph. Even though, noticeable is that BOI produces better quality when the output file size is 5 % of the original than 5,5% of the original (so the quality decreases when using lower compression but this is just a spike).

Grading

Grading was done based on the PSNR/SSIM graphs above. The grading was splitted in two parts: first give grading to codecs based on PSNR values and second give grading to codecs based on SSIM values. Codec was given a score with the following scale (grading was done separately to every PSNR/SSIM graph):

  • 5p: If some codec is better than all the others in more than 3 points
  • 1p: If some codec is worse than all the others in more than 3 points
  • 4p: If some codec is better than the remaining codecs in more than 3 points
  • 2p: If some codec is worse than the remaining codecs in more than 3 points
  • 3p: Otherwise it is given this score
  • -1p: If there is a noticeable drop in quality (one ore more points are significantly worse than the corresponding point of all the others codecs). So in this case, one point is reduced

So, first we look at the graphs below and search the best codec (if any) and give it 5 points. Then we search the worst codec (if any) and give it 1 point. Then we compare the remaining codecs (so the best and the worst codec are "thrown away"). If some of the remaining codecs are better than the other remaining codecs, it is graded 4. If some is worst than the remaining ones, it is given 2. If the codec isn't better or worse than the other remaining ones, it is graded 3. After this grading, we search if there are codecs that have a noticeable drop in quality and decrease their grade by one.

When giving the total grade for codecs, a weighted mean is calculated from all the grades such that all the other images are given weight 1 but Ruler image is given weight 0.5 since one wouldn't usually compress these kind of artificial images with lossy methods but rather use some lossless compression.

Grades for codecs when using PSNR values
LuraWave BOI Jasper JPEG HD Photo
Weighted mean 3 4.67 3 2.44 2.78
Place 2 1 2 5 4
Baboon 3 4 3 5 3
Barbara 4 5 2 1 3
Lenna 2 5 3 3 3
Lighthouse 3 5 3 1 3
Ruler 3 4 5 2 1
Grades for codecs when using SSIM values
LuraWave BOI Jasper JPEG HD Photo
Weighted mean 2.22 4.33 3.22 3.11 3
Place 5 1 2 3 4
Baboon 2 4 3 5 3
Barbara 2 5 3 2 3
Lenna 2 4 3 5 3
Lighthouse 2 5 3 1 4
Ruler 4 3 5 2 1

The grading isn't so scientific so one should not draw any big conclusions only based on that. One would perhaps get a bit different types of results if using different type of grading scale or compressing different types of images. The main points are that BOI is clearly the best and there are differences between metrics PSNR and SSIM. JPEG is last when comparing PSNR values but when moved to SSIM, it is third. Also LuraWave drops from second to last when changed to SSIM.

Visual comparison

No comprehensive subjective testing was done because there were over 150 compressed images. Also this would have been pretty useless because it is very hard to see any difference, with the naked eye, between compression levels 70, 90 and 100 (by these compression levels I refer to LuraWave's quality factor). This is well seen from SSIM graphs. All codecs are almost at the same line when looking compression levels 70-100 and their lines are much more horizontal than in PSNR graphs. However, everyone has their own opinions that which image seems better, so I saw this comprehensive subjective comparison rather pointless.

But there are some images where you can clearly see the difference between JPEG and JPEG2000 codecs and also the difference between PSNR and SSIM values. The images are presented below. On the right there are so called "difference visualization images". The more the image has colours the worse the compressed image quality is. So the quality from good to bad would be shown: black, blue, green, yellow, red.

Baboon image

Baboon BOI PSNR visualization
BOI (file size 61.9 kB, PSNR 32.63, SSIM 0.918)

Baboon JPEG PSNR visualization
JPEG (file size 61.9 kB, PSNR 31.20, SSIM 0.930)

According to PSNR values, BOI above is better than JPEG below. But according to SSIM values, JPEG is better than BOI. In my opinion, JPEG is better because JPEG2000 image seems to be more blurry (especially the nose and the lower right corner) so the SSIM value seems to represent better the image quality.

Barbara image

Barbara BOI PSNR visualization
BOI (file size 11.0 kB, PSNR 30.81, SSIM 0.866)

Barbara LuraWave PSNR visualization
LuraWave (file size 10.9 kB, PSNR 29.38, SSIM 0.828)

Barbara JPEG PSNR visualization
JPEG (file size 11.4 kB, PSNR 29.12, SSIM 0.822)

Here you can clearly see that LuraWave produces worse quality than BOI. If you look at, for example, the girl's knee or the hanging table-cloth, you can see how LuraWave loses more details (the stripes on the table-cloth and trousers). Also the face is much blurry with LuraWave. JPEG produces noticeable compression artefacts. This visual quality corresponds to the PSNR and SSIM values.

Lighthouse image

Lighthouse BOI PSNR visualization
BOI (file size 37.1 kB, PSNR 39.32, SSIM 0.960)

Lighthouse JPEG PSNR visualization
JPEG (file size 37.0 kB, PSNR 36.16, SSIM 0.952)

From lighthouse image you can clearly see the difference between JPEG2000 and JPEG. BOI has very good quality as you can see from the difference visualization image on the right. JPEG is clearly worse. If you look at the handrail, you can see how it is kind of scrappy. Also all the other edges are more blurry than in JPEG2000.

Conclusions

As you can see from the graphs, when using low compression JPEG and BOI produced the best quality and Jasper was the worst. Instead, when using high compression, Jasper did pretty well and so did BOI. BOI did well on both high and low compression and hadn't any strange drops in quality. JPEG and LuraWave produced clearly the worst quality when using high compression.

Very interesting finding was that, when using high compression, LuraWave produced continuously almost as poor quality as JPEG and sometimes even worse. JPEG produced much better quality than LuraWave at all compression levels in Baboon and Lenna pictures. This is quite good achievement since Baboon is said to be very hard to compress. However, JPEG was a pretty clear looser when looking at Lighthouse image, but again, LuraWave was nearly as poor as JPEG when using high compression.

I was very surprised that LuraWave did so poor at high compression, so I briefly tested LuraWave's commercial command line tool for compressing Baboon and Lenna images at high compression and it did give me way different results. LuraWave didn't any more produce as bad quality when using high compression (see images below). It was on the same line as BOI and maybe even better. Personally, I presumed that this LuraWave's IrfanView plugin would have been based on the command line tool and would have produced the same kind of quality, but apparently it isn't so. Afterwards, it would have been interesting to include this LuraWave's command line tool into comparison but there were no time for that within this course.

Lenna LuraWave IrfanView plugin PSNR visualization
LuraWave IrfanView plugin (file size 15.8 kB, PSNR 32.08, SSIM 0.865)

Lenna LuraWave command line PSNR visualization
LuraWave command line tool (file size 15.8 kB, PSNR 35.50, SSIM 0.921)

HD Photo wasn't bad but it wasn't so good either. It's quality is comparable to JPEG2000, as Microsoft claims, but it isn't any better than JPEG2000 implementations. And it definitely doesn't deliver "twice the quality of JPEG" as Microsoft says. Rather it produced pretty much same quality than JPEG, sometimes worse sometimes better. Moreover, how would you define "more than twice quality": double PSNR value, double SSIM or something else hazy definition.

There is a noticeable difference between metrics PSNR and SSIM. First of all, PSNR value doesn't say so much to average people. For example, when comparing Baboon image (compression level 30), PSNR values imply that BOI has produced better image than JPEG. But SSIM values say that JPEG is better than BOI. When comparing these images to the original uncompressed image one can see that JPEG seems to be a little better (image compressed with BOI is more "blurry", see the "Visual comparison" part). Also it is very hard to see any difference between low compressed images (compression levels 70, 90, 100) with the naked eye. SSIM graphs show this much clearly than PSNR graphs. For example, when compressing Baboon image at low compression level (100), JPEG seems to produce superior quality compared to all the others when measuring with PSNR. But when changed to SSIM they are pretty much same quality and if you look at them with the naked eye, it is very hard to see any difference at all.

Results that I obtained are a bit different compared to MSU JPEG 2000 Image Codecs Comparison, where LuraWave was one of the best implementations of JPEG2000 and Jasper (v1.701.0) was one of the worst. One should however note that there seems to be a big difference between IrfanView's LuraWave plugin and the command line version, although they are both from LuraTech. Also JPEG was compared in that test and it was clearly worse than any of the JPEG2000 implementations (also when using low compression). Apparently, the JPEG codec they used (from Adobe Photoshop v7.0) was some kind of crappy implementation of JPEG. IrfanView's JPEG codec produced much better quality. According to my test, JPEG isn't so poor as MSU's test imply. Also some other tests have shown that JPEG produces a bit better quality than JPEG2000 on some images when using low compression [1]. However, this depends much on the images used. Jasper have maybe slightly improved its quality after MSU's test but not much. BOI would have probably done well in that test.

Personally I don't see JPEG2000 or HD Photo so much better than JPEG that there is a great benefit to move using those formats. JPEG is still the most widely used lossy image format and I think it will be for a long time. JPEG2000 or HD Photo don't bring any revolutionizing image quality. They are a bit better than JPEG (especially at high compression) but not so much that it would be worth to convert all JPEG images to JPEG2000. But what it comes to IrfanView, I would recommend it to move using some different implementation of JPEG2000 than LuraWave. BOI would be the best choise but even Jasper did produce much more stable image quality and it is totally free.

Images and other artefacts used and produced in this test

References:

  1. JPEG vs. JPEG2000: An Objective Comparison of Image Encoding Quality (PDF)

Sivun kommentit