Live data from Hacker News

Ditherpunk: The article I wish I had about monochrome image dithering

surma.dev

111–120 of 203 posts

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#111
post #81

> However, sRGB is not linear, meaning that (0.5,0.5,0.5) in sRGB is not the color a human sees when you mix 50% of (0,0,0) and (1,1,1). Instead, it’s the color you get when you pump half the power of full white through your Cathod-Ray Tube (CRT). While true, to avoid confusion, it might be better rephrased without bringing human color perception or even colors into the mix. sRGB uses non-linear (gamma) values, which…

I always feel we have way too many historical burdens (which were good compromises at the time) in (digital) image/video field.

In no particular order (and some are overlapping), I can immediately think of gamma, RGB/YCbCr/whatever color models, different (and often limited) color spaces, (low-)color depth and dithering, chroma subsampling, PAL/NTSC, 1001/1000 in fps (think 29.97), interlaced, TV/PC range, different color primaries, different transfer functions, SDR/HDR, ..

the list can go on and on, and almost all of them constantly cause problems in all the places you consume visual media (I do agree gamma is one of the worst ones). Most of them are not going anywhere in near future, either.

I often fantasize a world with only linear, 32-bit (or better), perception-based-color-model-of-choice, 4:4:4 digital images (similar for videos). It can save us so much trouble.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#112
post #78

Slightly offtopic, but this is a greate opportunity to ask what I always wanted to know. Can anybody tell me how protraits like the one in the linked article below are made? I always loved this dithering style. https://www.wsj.com/articles/SB10001424052702304418404579467... Edit: I found that the style seems to be called "hedcut".

The traditional WSJ Hedcut portraits are drawn by hand, although they now have a ML tool that makes a reasonable facsimile: https://www.wsj.com/articles/whats-in-a-hedcut-depends-how-i...

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#113

Back when I worked at Marvell Semiconductor (circa 2005), we made laser printer ASICs for HP. We did a lot of dithering in hardware. We had a hardware block that did error diffusion, we had a hardware block that did regular diffusion. We also had a hardware block that did Blue Noise. I was responsible for implementing the firmware that drove those printers' scan/copy path: scan an image in monochrome, run through the…

There is no math.Random() in hardware, so I have to ask: what algorithm did the noise block use? :)

Not the OP, but since repeatability is not a problem you can just use any cheap and insecure random number generator and hardcode a constant for the seed.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#114
post #91

Is it just my eyes or does the gradient dithered in sRGB look more accurate that the one dithered in linear space?

If it does, then it probably means you've got some funky substandard or non-standard LCD panel or gamma setting or color correction on whatever you're viewing it on.

Which isn't terribly unusual. But if your screen is well calibrated, then no -- the sRGB gradient should by definition be identical. That's literally the specification.

(And it is on my MacBook, as Apple screens tend to be among the most accurate of general consumer screens.)

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#115

What about dithering for the smallest possible images? I'm talking in the 300 byte - 2kb range here. Does anyone have any suggestions for what to do to really get file size down?

Author here! I don’t think many people have researched or optimized on this, but I also work on https://squoosh.app , and from that experience I know that dithering makes compression _worse_ most of the time (unless you use PNG and use a super small palette of colors). Interesting idea tho!

[deleted]

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#116
post #57

Another way to think of dither (that may only make sense to people with a signals background) is that it linearizes the error introduced by the quantization step (which is a non-linear process). This has a bunch of conceptual implications (like elimination of error harmonics being natural consequence) but maybe most importantly allows you to continue using linear analysis tools and techniques in systems with a quanti…

This thesis on noise shaping and dither http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pd... is an excellent mathematical treatment of the subject.

Very cool paper. Something that bothers me is that the Floyd-steinberg error diffusion without dithering looks superior than the version with the dithering. I think this demonstrates that perceptible patterns in the error (non-linear) don’t always look so bad.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#117

Shameful tangential plug alert: My sideproject is a dithering-based image-to-pattern converter for plastic fuse beads (you know them, the ones you place on a platter and iron to fuse them together): https://www.beadifier.pro/

You could probably adapt this to rug hooking kits pretty easily. Random example site (first one in DDG search results: https://woolery.com/rug-hooking/kits.html)

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#118
post #57

Earlier quoted context omitted.

This thesis on noise shaping and dither http://uwspace.uwaterloo.ca/bitstream/10012/3867/1/thesis.pd... is an excellent mathematical treatment of the subject.

Very cool paper. Something that bothers me is that the Floyd-steinberg error diffusion without dithering looks superior than the version with the dithering. I think this demonstrates that perceptible patterns in the error (non-linear) don’t always look so bad.

One thing I've found (admittedly with audio) is that you can usually get away with less dither power than is needed to completely linearize the error, at the cost of some harmonics for pathological signals which still ends up being less noticeable than the higher power dither noise.

I expect something similar to apply to images.

Re: Ditherpunk: The article I wish I had about monochrome image dithering

#119

Earlier quoted context omitted.

There is no math.Random() in hardware, so I have to ask: what algorithm did the noise block use? :)

Not the OP, but since repeatability is not a problem you can just use any cheap and insecure random number generator and hardcode a constant for the seed.

The period needs to be sufficiently long such that it won’t show up as visible artifacts. I would think something like PRBS23 would do the trick and be trivial to implement.

That’s the cheapest choice. Better whiteness could come with some added complexity.

Post reply on HN