A Picture That Paints Itself


How Could a Picture Possibly Paint Itself?

I can think of a couple of ways.

There’s an odd cookie (in a good way) programming language called Piet in which programs are represented as images. I suppose it’d be possible to write a quine in Piet. Could be fun, even!

But you don’t have a Piet interpreter in your pocket.

So let’s go with QR Codes.

What’s a QR Code?

Go ahead, change the text! Read it from your phone’s camera! Isn’t modern technology javascript magical?

You can put whatever you like in a QR code. Unfortunately, so can I.

I could put this blog post’s URL in one manually. After all, I already know what the URL will be.

But That’s No Fun

That’s not a question. Also you are correct.

Here’s a small html snippet:

<script src="https://unpkg.com/easyqrcodejs"></script>
<div id="qrcode"/>
<script>
 new QRCode(document.getElementById("qrcode"),
            { text: window.location.href })
</script>

(I mean, you’re supposed to declare <!DOCTYPE html>, but sue me.)

You can host that anywhere and it will give you a QR code of it’s own page. I’m hosting it here. View source if you don’t believe me.

I definitely have not posted it on my nearest bus stop.

Use it as 404 page, I dare you. Nothing could go wrong, who could possibly complain?

That’s Quite a Quine, though, is it?

No, not by any definition I can think of. But it is distinctly quinier (it’s a word because I say it is) than simply using literal value.

Got a Better Idea?

If only there existed a method of writing a whole webpage in a URL.

That would be cool, wouldn’t it? Big shame it doesn’t exist.

That Couldn’t Possibly Work!

Again, with the not-a-question.

QR code