VOOZH about

URL: https://bjango.com/articles/1pxisnotenough/

⇱ 1px is not enough


Apps Articles Help Contact

1px is not enough

The image below tells an interesting story. It is only a small interface fragment, but with careful inspection, so much can be known about it.

👁 Image

That’s a section of Safari’s titlebar from macOS El Capitan, but that’s not important — I’m not trying to single out a product or person. I just spotted a few anomalies and decided to investigate further.

If we add some contrast, the window titlebar becomes grainy, and the button becomes split into distinct blocks. Why?

👁 Image

Let’s take a look at the button first.

Toolbar button #

The sharp gradient steps indicate that there’s no dithering. Dithering attempts to increase the apparent colour depth, by error diffusion or adding patterned noise. Up close, and with contrast added, dithering typically looks like noise. When used well it can drastically increase the quality of gradients.

Core Graphics dithers gradients, so that makes it unlikely the button was drawn with code or created using a tool based on Core Graphics. It also rules out PDF assets and other Core Graphics rendered paths.

The button almost certainly had to be created in Photoshop, which can optionally disable dithering, or Illustrator, which has no gradient dithering.

We can also see that the gradient steps are evenly spaced — the gradient uses linear interpolation. The default for gradients in Photoshop is for spline interpolation, rather than linear interpolation (the smoothness setting in Photoshop controls interpolation).

👁 Image

There’s also another issue. Some values are missing. The gradient is entirely greyscale, and it jumps from #fcfcfc (252) to #fafafa (250). What happened to #fbfbfb (251)? To me, that looks like a rounding error. The kind of error that appears when a colour profile conversion is done, or due to some other compositing rounding error. Again, if I had to guess, I’d say Illustrator or Photoshop color management wasn’t set up correctly for screen design, because by default they’re not.

Which tool created the El Capitan toolbar button assets? If I had to guess, I’d say Illustrator, with Photoshop as my second guess.

Toolbar #

The toolbar is different. At first glance, it doesn’t appear to be dithered. But, the horizontal lines suggest that gradient dithering has been used with a 1 pixel wide repeating section. For dithering to have enough space to work, more pixels are needed.

For comparison, I’ve drawn some versions of the same gradient, dithered, with contrast increased. The 1px wide repeating version looks a lot like the shipping toolbar in El Capitan.

👁 Image

The pattern repetition is obvious until somewhere around 10px. Sure, we’re zoomed in and contrast has been increased, but why lower the quality of your work when you don’t need to? If you’re using 3 part images for dynamic widths or heights, the repeating sections will need to be 10px or larger. 1px is not enough, unless no gradients are involved.

Given the toolbar gradient is dithered, it couldn’t have been created in Illustrator.

Window toolbars and titlebars macOS can be different heights. Here’s screenshots of all the possible Finder toolbar heights, with contrast added.

👁 Image

If it was an image being stretched, I’d expect the dithering pattern to be consistent across all heights. But it’s not. The pattern is completely different at each size. If I had to guess, I’d say the gradient is being drawn with code, but for some reason a 1px wide section is being repeated.

macOS Mavericks’ toolbar gradients are different, and higher quality. The noise/dither pattern repeats every 128 points — more than enough to make the repetition hard to see, and more than enough to keep the gradient nice and smooth.

👁 Image

Dithering as a signature #

In some cases, it might be possible to know which design tool created an image, just by inspecting the dithering. The dithering used by Photoshop and Core Graphics look very different.

👁 Image

Shape antialiasing can also be distinct enough to identify the source renderer.

👁 Image

If you’re drawing gradients in code or with a design tool, dithering can really help improve their quality. And, if you’re dithering, please make sure repeating sections are wide enough to let the dithering work.

Published 8 July 2015.

Featured articles

The vocal effects of Daft Punk

Matching drop shadows across CSS, Android, iOS, Figma, and Sketch

Two decades of Bjango

Design systems need a colour space

Blur radius comparison

Design tool canvas handles

Design tool memory usage

Shape builder vs pathfinder

Formulas for optical adjustments

Smaller Mac app icons

Icon speedrun videos

Fingerprint icon speedrun

Fountain pen icon speedrun

Pushpin icon speedrun

Flag icon speedrun

Designing macOS menu bar extras

SVG passthrough precision

Ideal SVG exports

Mac external displays for designers and developers, part 2

Camera iris icon speedrun

Opacity precision

Design tool performance signatures

Diagnosing common colour management issues

macOS prefs tab icons are 27×27pt

What is pass-through blending?

Colour management, part 4

Magnet icon speedrun

Soccer ball icon speedrun

Puzzle icon speedrun

Using SVGs in asset catalogs

My Illustrator snapping settings

Perfect loops in Processing

Testing for wide gamut

Creating SVGs with Processing

Colour management, part 3

Colour management, part 2

Colour management, part 1

Vector icon speedruns

My Mac app icon design workflow

Color Creator Templates

When two colours can be one

Mac external displays for designers and developers

Greyprint

Batch processing with Generator

Using blend if for masking

Design debugging

Interaction density

1px is not enough

My icon design workflow

Why Skala won't have artboards

Why I don't use PDFs for iOS assets

Blend if

Gradient maps

About the author

Marc Edwards is the founder and designer at Bjango. Subscribe via RSS to be notified of new articles. Marc on Mastodon. Marc on Bluesky.

We’re building a design tool! Learn more about Skala.