Question

I'm trying to understand the JPEG compression process and performed the following steps to verify a few things.

I take an input image img1.jpg and compress it by using IrfanView, say quality=50 (img1_compress.jpg).

Then I crop a small block from the input image img1.jpg (block.jpg of size 8x8 at X,Y=16,16) and compress it by using the same value of quality parameter (50). Let's call it block_compress.jpg.

Now when I compare this block's pixel values with the one in fully compressed image, they don't match.

To clarify, the pixel value at position 0,0 in block_compress.jpg should match with the pixel value at position 16,16 in img1_compress.jpg.

I'm confused why pixel values don't match? Any ideas?

Was it helpful?

Solution

I just did this experiment with my JPEG codec and the pixel values match. Irfanview may be applying some kind of noise filter or other modifications when it compresses JPEG images. Without seeing the source code to the codec you can't know what it's doing. Your experiment is valid, but by using other people's code to test your theory you can't know what's really going on inside their code.

OTHER TIPS

JPEG is lossy compression algorithm. Compressing one image with identical compression settings in different tools can produce differ result. You need use one of lossless algorithms if you want pixel-to-pixel result. I.e. you can use PNG

"the DC component of each 8x8 block is predicted from the previous block.” : by Oli Charlesworth

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top