How to know what pixels where compressed and not compressed in a image?

5 views (last 30 days)
Havin a image (jpg or png - I can have lots of extensions) it's possible to know what them was compressed?
For exemple, let's say that I have a 1280 x 720 image. Than in a uncompressed image I will have a 1280 x 720 matrix of int values representing the image.
But if the same image is compressed (if possible), will be less then that.
My goal: I need to process a image (compressed) and have a vector of ones and zeros representing their pixels. The ones means that the pixel in that position it's important and wasn't compressed. Otherwise, zeros means that this particular pixel is not important and was compressed.

Accepted Answer

William Rose
William Rose on 28 Nov 2022
It is not true that specific pixels are compressed or not compressed whn an image is compressed. The JPEG algorithm does a color transofrm on the entire eimage, then the chrominance component of color (at every pixel) is downlsized. This means that the color information at each pixel is now more coarse than originally. Then the image is divided into 8x8 pixlel cheunks, and each chuink is processed with a dicrete cosine transoform, and discarding the higher frequencies from each 8x8 black. Therefore this comptession step also does not keep or reject specific pixels. The last compression step, Huffman coding, also compresses in a way that is not pixel-specific.
PNG and other compression algorithms are also complex, like JPEG, and do not correspond to keeping or rejecting specific pixels.
William Rose
William Rose on 30 Nov 2022
Please email me to continue our discussion. Click on the WR circle next to my name. A window will appear, with an envelope icon in the top right corner. Click on the envelope to send me your email address, and I will reply.

Sign in to comment.

More Answers (0)


Find more on Denoising and Compression in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by