July 4th, 2024

Do grayscale images take less space?

Grayscale images are space-efficient, but optimized sRGB images with 4:2:0 subsampling can match their size. Y'CbCr color space in formats like JPEG allows separate optimization of brightness and color, balancing file size and visual quality effectively.

Read original articleLink Icon
Do grayscale images take less space?

Grayscale images typically occupy less space compared to sRGB images due to the simpler representation of each pixel. However, aggressive optimizations on the chroma channels in sRGB images can sometimes make a 4:2:0-subsampled image close in size to a grayscale image. The Y'CbCr color space is used internally in formats like JPEG/JFIF, allowing for separate optimization of the luma (brightness) and chroma (color) channels. Subsampling techniques like 4:2:0 significantly reduce file size by prioritizing luminance over color information, leveraging the human eye's sensitivity to brightness changes over color changes. While grayscale images are efficient in size, they do not offer significant gains over optimized sRGB images subsampled to 4:2:0. This optimization balance ensures reduced file sizes without compromising visual quality, making it a common practice for web image distribution. Subsampling plays a crucial role in determining the final image size, with 4:2:0 being a prevalent choice due to its effective balance between compression and visual fidelity.

Link Icon 13 comments
By @AnarchismIsCool - 6 months
In JPEG*

The title should reflect that. Obviously this is misleading otherwise, there are a million ways of representing grayscale in data.

Sure, you can argue just picking a color channel and making it the grayscale source is not gonna work as expected, but what if we're talking about the data off a pan sensor vs an RGB array? What about a pan sensor created by taking an RGB sensor and removing the filter so it's producing an image with 3x the resolution but in pan?

This is a complicated question.

By @dynm - 6 months
This post jumps into using "4:4:4" / "4:2:2" / "4:2:0" notation without seeming to explain what it means. Would be very helpful to add a short explanation!
By @vander_elst - 6 months
I don't understand the point of the article, it seems to me that the point is that non compressed grayscale images don't take a third of the space of a compressed image? If we look at the last example the fist image 4:4:4 is 150KB the one in gray is 50KB (it seems exactly 1/3), the compressed images in-between take less space, but also the quality is much worse, I would say as expected. What am I missing?
By @morsch - 6 months
I appreciate the article, but isn't the example image of a grey bird on cobblestone looking on a dark pool of water an odd choice to illustrate color subsampling?
By @immibis - 6 months
The Y channel of the 4:4:4 "sub"sampled image looks sharper than the other comparison images. Look at the ground next to the bird's feet. I perceive it as sharper in the 4:4:4 image even though it's just about a single colour and the luma was supposedly not subsampled.
By @arh68 - 6 months
I remember white/black-dithering (at even twice the dpi) being a lot smaller than the greyscale jpeg, when I was scanning documents. Greyscale was a bit smaller than full color, but dithered was a big step up (er, down).
By @xxr - 6 months
Somewhat related, a few years ago I noticed that an image with gaussian blur applied to it takes up significantly less space in JPEG than does the original image. I suppose it works out because the blur diffuses information throughout a particular area such that each JPEG block has less detail to encode internally?
By @bawolff - 6 months
Is it just the subsampling?

Naively i would assume that even if you have the unnessary the C_b C_r channels in a greyscale image, they are going to compress really well since they have very little information in a greyscale image.

By @jdefr89 - 6 months
I wonder if grayscale images are more efficient for compression to some degree. Too lazy to actually test or even explain why I am wondering...
By @Dwedit - 7 months
Yes. No CB or CR channels.
By @fedeb95 - 6 months
this may be true for screen, but what about printing?
By @atoav - 6 months
Does a mono sound take more space than a stereo sound file?

Yeah, half. Provided you don't store a mono sound in a stereo audiofile.

Same thing for grayscale images. If your white is a #FFFFFF instead of a #FF your picture is a color file that coincidentally displays a grayscale image.

By @simonblack - 7 months
Roughly a third.