Resize JPEG image during decoding

I am working on a program that creates thumbnails of JPEG images on the fly. Now, I thought: since a JPEG image is built from 8x8 pixel blocks ( Wikipedia has a great explanation ), would it be possible to skip the decoding part?

Say my thumbnails are at least 8 times smaller than the original image. Then we could map each 8x8 block in the input file by 1 pixel at the decoding output, including only the constant term of the discrete cosine transform. Most of the image data can be immediately discarded and does not need to be processed. In addition, memory usage is reduced by 64 times.

I do not want to implement this from scratch; which will easily take a week. Is there any code that can do this?

If not, is it because this approach is not worth it, or simply because no one has thought about it yet?

+7
resize thumbnails jpeg decode
source share
3 answers

I think the djpeg scale function does something like this.

It can scale an 8x8 block to any size from 1 to 16 pixels.

"This is interesting because different volumetric output can be obtained directly from JPEG data (DCT) without separate full decoding and spatial conversion."

+4
source share

In accordance with this answer, the EPEG from Enlightenment did just that by collecting DCT coefficients in order to zoom out by 8 times. Here is the current EPEG home .

+2
source share

The project I'm working on is currently using ImageGen , which does all sorts of resizing on the fly - it can pay for if the list of functions matches what you want. Otherwise, I assume that you are trying to implement lossy file compression on images, which should have been done before!

0
source share

All Articles