how to encode Image containing single row using jpeg

209 Views Asked by At

While I was reading jpeg spec, I came to know while encoding jpeg, image is first broken into 8x8 blocks then DCT and other things happen. So I am curious to know how would an image (raw file) containing a single row get encoded using jpeg? would jpeg add extra 7 rows to file so that it can break it in 8x8 blocks?

2

There are 2 best solutions below

0
On BEST ANSWER

A very nice explanation is given in https://dsp.stackexchange.com/questions/35339/jpeg-dct-padding

From Baseline JPEG:

The image is partitioned into blocks of size 8x8. Each block is then independently transformed using the 8x8 DCT. If the image dimensions are not exact multiples of 8, the blocks on the lower and right hand boundaries may be only partially occupied. These boundary blocks must be padded to the full 8x8 block size and processed in an identical fashion to every other block. The compressor is free to select the value used to pad partial boundary blocks.

0
On

In JPEG compression, images that are not multiples of the MCU size are padded upwards to that size.