Live data from Hacker News

How My Images Are Dithered

dead.garden

41–50 of 81 posts

Re: How My Images Are Dithered

#41

> Dithering can reduce file size Yeah, if you're using lossless compression like PNG or GIF, adding a lossy step to reduce the number of colors in the palette can help. If you're compressing photos, you should use JPEG or WebP. Anecdotally, JPEG usually beats dithering, and WebP always does. It's fine to dither images but please please admit that you're doing it for the aesthetic. WebP has very broad browser support…

.. What do you mean by "beats" here? Is the article trying to hide the fact that they're doing dithering for, among other things, artistic reasons?

A dithered image almost certainly beats a non-dithered JPEG compressed image in terms of file size, because you can JPEG compress the dithered image. Thus, if you like the look of a dithered image, you get file size reduction as a bonus.

I swear, some people on HN intentionally misinterpret and misrepresent the text of an article just to argue against it in bad faith with these smarmy "um actually" type arguments. For some reason I do not understand, Hacker News tends to surface these comments near the top of its comment sections.

Re: How My Images Are Dithered

#43
post #29

Earlier quoted context omitted.

True! You’re less likely to be surprised by banding on a display, because you can see it before it’s a problem, and it’s less likely to cost money, but for sure the need for dithering is still there, especially for displays that can do more than 8 bits per channel or can do high dynamic range. > Consider that a grayscale gradient can only have 256 distinct levels. This is true, but also keep in mind that for print an…

I think HDR wasn't what changed. It's resolution. At 720P and below, you don't notice dither because pixelation is the more obvious problem. Once you're at 1080p (and it's more obvious at 1440p/4k), you start having enough detail to see the banding patterns.

I don’t think I agree with that at all. Color banding is a problem with NTSC - 540 interlaced, and lower resolutions too. If you have a smooth gradient that shows color banding, spatial resolution is completely irrelevant. Pixelation is a separate, orthogonal issue. It would be trivial to show color banding, and the need for dither, on a 16 x 16 pixel image.

HDR is what changed - it requires more than 8 bits per pixel, by definition!

Again, if you only have LDR (low dynamic range), the human visual system’s “just noticeable difference” or JND in the perception literature demonstrates we only need 8 bits when looking at things under ‘indoor’ lighting conditions. You don’t need dithering if you use LDR on a single specific 8-bit display. You do need dithering when either moving to a different display than the one you started with, or using an HDR display - capable of displaying more than 8 bits of color resolution.

Re: How My Images Are Dithered

#45
post #41

> Dithering can reduce file size Yeah, if you're using lossless compression like PNG or GIF, adding a lossy step to reduce the number of colors in the palette can help. If you're compressing photos, you should use JPEG or WebP. Anecdotally, JPEG usually beats dithering, and WebP always does. It's fine to dither images but please please admit that you're doing it for the aesthetic. WebP has very broad browser support…

.. What do you mean by "beats" here? Is the article trying to hide the fact that they're doing dithering for, among other things, artistic reasons? A dithered image almost certainly beats a non-dithered JPEG compressed image in terms of file size, because you can JPEG compress the dithered image. Thus, if you like the look of a dithered image, you get file size reduction as a bonus. I swear, some people on HN intenti…

> A dithered image almost certainly beats a non-dithered JPEG compressed image in terms of file size, because you can JPEG compress the dithered image. Thus, if you like the look of a dithered image, you get file size reduction as a bonus.

That's backwards. Dithering (and simulated halftoning, as in this case) adds detail/noise, making images harder to compress efficiently.

Re: How My Images Are Dithered

#48

> Dithering can reduce file size Yeah, if you're using lossless compression like PNG or GIF, adding a lossy step to reduce the number of colors in the palette can help. If you're compressing photos, you should use JPEG or WebP. Anecdotally, JPEG usually beats dithering, and WebP always does. It's fine to dither images but please please admit that you're doing it for the aesthetic. WebP has very broad browser support…

> Yeah, if you're using lossless compression like PNG or GIF, adding a lossy step to reduce the number of colors in the palette can help.

Depending on the image context it can also backfire, though not so much for photos, but rather screenshots. E.g. sometimes a 2 color dithered image results in a much bigger PNG than, say 16 colors without dithering, because bigger areas of uniform color compress much more efficiently. So I usually just try "everything", to find some sweet spot between file size and quality.

Is there a tool that allows you to select which area of the image to use what dithering parameters and color count for, with a live preview? I know I'll vibecode one myself just to see what it looks like, but maybe this already exists in a "real" application? Then you could e.g. use dithering on the faces, but for the background just a few colors without dithering.

Re: How My Images Are Dithered

#50
post #17

Speaking of which, are there any good ways to undither images? Things like GIMP FFT are not perfectly reversible.

Dither loses information, so perfectly reversible might be an unreasonable goal. But I bet you could train or fine-tune a denoiser to do a really good job. This might make a cool paper, if there’s anything at all non-standard or surprising you discover along the way.
Post reply on HN