Skip to main content
Share Your Experience: Take the 2024 Developer Survey
16 votes
Accepted

Which image filter can be applied to remove gridded pattern from corrupt jpegs?

You can use a standard inpainting algorithm. These algorithms replace marked pixels in an image with the pixel values that surround these marked pixels. The challenge here is to detect the grid (my ...
Maximilian Matthé's user avatar
5 votes

What would produce this "hamburger" corruption on images?

JPEG projects $8\times 8$ blocks of images onto $64$ 2D cosine patterns: The one in column $1$ and row $5$, once quantized, may look like your hamburger. Luminance and chroma components may get ...
Laurent Duval's user avatar
4 votes
Accepted

JPEG DCT padding

The filling is performed to the right ($[1\,,1\,,3\,,x_1\,,x_2\,,x_3\,,x_4\,,x_5]$) or the bottom ($[1\,,1\,,3\,,y_1\,,y_2\,,y_3\,,y_4\,,y_5]^T$), line by line or column by column. The extended values,...
Laurent Duval's user avatar
4 votes
Accepted

Confirming what a compression ratio is

Neither. A true compression ratio is: "original file size in bits" divided by "compressed file size in bits". A practical (based on disk limits) compression may embed the chunk size effect: "...
Laurent Duval's user avatar
4 votes

Does every 8 by 8 DCT matrix have a valid (in range) IDCT?

All images blocks that are applied by DCT matrix have a valid IDCT - i.e. they can always bring back original pixels and in general inverse transfer is theoretically as well as computationally viable. ...
Dipan Mehta's user avatar
  • 5,597
3 votes

Which image filter can be applied to remove gridded pattern from corrupt jpegs?

I tried a really simple algorithm of running a 3x3 median filter on the R and G channels of that image and it works quite well. The python code is really simple: ...
Atul Ingle's user avatar
  • 4,134
3 votes

How Does Color Conversion and Downsampling work When JPEG compressing a grayscale image?

Normally, monochrome images should be stored as images with a single channel. However, I have seen digital images with three channels containing the same values. This results in a displayed image ...
Laurent Duval's user avatar
3 votes
Accepted

What are the cosine functions in JPEG's DCT-II table?

Those 2D cosine functions are independent of your input image. They are just "cosine waves", or the 64 basis functions that yield 64 coefficients when transforming "$8\times 8$" blocks. Given a $D$ $8\...
Laurent Duval's user avatar
3 votes

How many 8x8 JPEGs exist with distinct DCT given a quality level?

Well, $8\times 8$ is simply 64 individual values. Now, if you had a quantization matrix $Q$ (dimensions $8\times 8$) with all $1$s, you'd have 8 bit to spend on every entry in your DFT, so that's $...
Marcus Müller's user avatar
3 votes

compression ratio of pixels block

Compression ratio is $$ \frac{N_{uncomp}^b}{N_{comp}^b}$$ where ${N_{comp}^b}$ is the total number bits requried to represent those $3$ pixels $A$,$B$, and $C$ while ${N_{uncomp}^b}$ is the total ...
Fat32's user avatar
  • 28.3k
3 votes
Accepted

How does Jpeg encoding affect the final file size of 24BPP RGB and 8BPP grayscale image?

Take a standard R-G-B coded 24-bit image. First, suppose that all channels are coded independently. If by chance, R, G, and B are equal, each one will be converted to the same JPEG file with size $s$. ...
Laurent Duval's user avatar
3 votes
Accepted

Why doesn't JPEG file format follow indexed color technique?

Because JPEG is for «natural images» containing smooth gradients, while indexed color is great for many kinds of artificial images containing sharp transitions and a single color background.
Knut Inge's user avatar
  • 3,434
3 votes

What happens when you read and save the same JPEG image again over and over?

JPEG is lossy compression, and it is allowed to do anything deemed beneficial in representing an image as accurately as possible using the minimum amount of storage while keeping cpu load in check. ...
Knut Inge's user avatar
  • 3,434
2 votes

JPEG DCT padding

What if image dimension not a multiple of 8?How padding works? If the image width and height are not multiple of 8, the image will be padded with zeroes most commonly.. How 8*8 blocks are chosen ...
Navin Prashath's user avatar
2 votes

Skip corrupt part of jpeg

Often it's possible to detect invalid markers or Huffman decompression errors. If bottom part is grey though, it's most likely invalid marker inside JPEG image data. JPEGSnoop will tell exact byte, ...
Joep van Steen's user avatar
2 votes
Accepted

Do JPEG formats add significant overhead?

This all boils down on what you call JPEG. If you are refering to the entire ITU-81 specifiation, then you can achieve much better compression ratio. Since your ...
malat's user avatar
  • 164
2 votes

Do JPEG formats add significant overhead?

JPEG standard will not care about how an image was generated; rather it looks for their block based statistical properties reflected in their quantized DCT coefficients. Under the same compression ...
Fat32's user avatar
  • 28.3k
2 votes

Do JPEG formats add significant overhead?

The picture you've posted most certainly didn't come directly from the image sensor – it was processed by the camera hardware, and software; it's pure dark grey. Anyway; JPEG (to be more specific: ...
Marcus Müller's user avatar
2 votes
Accepted

Image not divisable by 8? (JPEG Compression)

Then its size is extended by padding zeros or repeating at the end, such that the new size is divisible by 8. Note that reverse repetition at the end reduces the DCT compression size on that block ...
Fat32's user avatar
  • 28.3k
2 votes

Does decoding jpeg images uncompresses them?

Decoding is sometimes another word for uncompressing. Compression used to be called "source coding" (in comparison to channel coding). For images compressed at a single resolution, like in ...
Laurent Duval's user avatar
2 votes
Accepted

Does decoding jpeg images uncompresses them?

Image processing is mostly done on frames. The digital image frame is a rectangular raster of pixels, either in an RGB color space or a color space such as YCbCr. So, as you noticed, you can be sure ...
V.V.T's user avatar
  • 1,739
2 votes

What is facebook's image compression algorithm?

If you have access to the bitstream, you should be able to figure out which codec they are using. Assuming that it is good old jpeg, possibly with a tweaked encoder implementation, I would parse the ...
Knut Inge's user avatar
  • 3,434
2 votes

What is facebook's image compression algorithm?

As couple of years ago, I asked a former colleague, who is now working at Facebook on Artificial Intelligence, whether they used internally something else than JPEG. And the answer was: "no"....
Laurent Duval's user avatar
2 votes
Accepted

Perfect lossless rotation of JPEG image (ITU 81)

The basic unit for color components is 8 by 8 only if no chroma subsampling is used, i.e 4:4:4 format. Most likely your test image uses this, but not all images do. When 4:2:2 chroma subsampling is ...
Justme's user avatar
  • 2,303
2 votes

jpeg compression: necessity of dividing input image into 8x8 blocks

let us first make this clearer: "is it necessary to divide the input image into 8x8 blocks and perform a DCT on each of the 64 blocks". We divide the picture into blocks of size $8\times 8$, ...
Laurent Duval's user avatar
2 votes

Why doesn't JPEG file format follow indexed color technique?

Besides Knut’s argument that indexed color cannot represent color gradients well, we can also look a the compression method. The JPEG compression relies on similarity between neighboring pixel colors. ...
Cris Luengo's user avatar
  • 2,584
2 votes

What happens when you read and save the same JPEG image again over and over?

The first application of JPEG to a BMP image is the stage at which data compression (and data loss) happens, amount of which is indicated by the quality parameter and input image statistics (or ...
Fat32's user avatar
  • 28.3k
2 votes

Why does MP3 use modified DCT?

the modified discrete cosine transform (MDCT) is a lapped transform, which means it is applied to consecutive blocks of audio data in linear time. your analogy to jpg is exactly why it is used, ...
zhiguang's user avatar
  • 131
1 vote
Accepted

DC Coefficient of JPEG Block

The $8\times 8$ 2D DCT-II transformation is defined, for integer indices $(u,v)$ as: $$ D[u,v] = c_uc_v \sum_{m=0}^7 \sum_{n=0}^7 \cos \left(\frac{(2m+1)\pi u}{16} \right) \cos \left(\frac{(2n+1)\pi ...
Laurent Duval's user avatar
1 vote

DCT - Coefficients and Basis Function

When DCT is defined by a matrix, then this matrix contains the necessary information to build the basis functions. Suppose that $I$ is your $8\times8$ block, and $D$ a real $8\times8$ matrix for a ...
Laurent Duval's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible