Hacker News new | ask | show | jobs
by kundor 1546 days ago
That's still a choice of palette; you'll find it listed on Wikipedia [1] under "Regular RGB palettes".

There's no doubt it's a much more objective choice than the one I used! I did say I was cheating.

Going to 4-bit color won't make it feasible. Even with 1-bit black/white pixels on about the minimum possible 18x24 Waldo face, you have 432 bits to look for, and you're not going to find them without cheating somehow. This guy on Twitter tried pretty thoroughly: https://twitter.com/gsuberland/status/1508697913177915393

For the palette hack, you want to go the other way; it's easier with bigger pixels. I was able to create a perfect Waldo face from the first 988 bytes of π as a TIFF, where the standard supports 16-bit palette indices for the pixel data. Unfortunately nothing except imagemagick seems to support actually viewing these TIFFs.

[1] https://en.wikipedia.org/wiki/List_of_monochrome_and_RGB_col...

3 comments

I made a video showing a slow zoom-in to Waldo in the first hundred million hex digits of pi, using your color palette. Feel free to use it if you want with a link back to this comment, I release it under CC-BY.

https://0x0.st/oq0Q.mp4

(The idea is basically that each consecutive 988 bytes gets put into an individual 19x26 8 bit image with your color palette, and these are then stacked in row order.)

I added a reduced preview of this to my blog post. I really like how it gives an impression of finding Waldo in a haystack of noise, just like in the picture books.

The preview is not as pretty as the real thing, but I thought embedding a 27MB video in the page might be a bit much.

Yeah I did my best to compress it but it's so noisy that there's very little compression that can be done without turning it into a blur. I can give you the original lossless PNG frames if you want them, but honestly I don't know that they'd be that useful.

Here's one lossless frame from near the end of the video, it's kinda nice because it gives you a little bit of context for the final Waldo without being overwhelming. https://i.imgur.com/wNZICnP.png

Here's also the full image as a 21.2 MiB PNG: https://ipfs.io/ipfs/QmUJaeon4KjE2RGVirXTG5xQuA6pCWV5T9GW2KS...

The full image contains the first 99969546 digits of pi, including the opening 3.

That's awesome!
I am really curious about the search algorithm. I love the palette hack, how did you find candidates to then start searching through the possible palettes?

I can sort of think of:

1) Collapse the colours in the palette to the minimum necessary to be seen as "Waldo". The more slack in the gif palette the better - 24bit colour vs 16 colours (or fewer) in the starting image?

2) For each substring in Pi, map the hex value to a colour (or close to the colour) to match the expected image.

3) find best match - how?

How to backtrack though?

Perhaps pin important fragments?

The glasses and chin seem more important?

Another pass.

We're looking for a substring with the largest number of unique values. If we have unique values, we can paint each value with a colour close enough to the expected value that humans will see them as the same.

Maybe?

Yes, it helps to have more unique values. We want each repeated byte to occur in part of the pattern where a color also repeats.

What I do is search for substrings with the fewest repeated bytes that don't match the target pattern. I prioritize first minimizing conflicts between light (white and tan) vs. dark (black and red). Reducing other conflicts is a tie-breaker.

The featured gif has 79 "mismatched" pixels out of 494, by the black/white metric. I've found candidates with as few as 75, but subjectively I didn't think they looked as good.

Would not the best choice of palette be the one immediately preceding Waldo in π?