Hacker News new | past | comments | ask | show | jobs | submit login
Redditor creates working anime QR codes using Stable Diffusion (arstechnica.com)
662 points by samizdis on June 6, 2023 | hide | past | favorite | 100 comments



This is an amazingly beautiful hack. I'm kind of surprised we never saw something like this done by hand before the advent of SD -- plenty of QR code art, but none of it like this. I'm impressed.


There are quite a few doing them by hand, eg https://dribbble.com/shots/3658816-Art-QR-Code-Design

I seem to remember some NY artist trying to sort of vaguely claim/intimate invention (falsely) by having an exhibition too. Ah yes, here https://art-qrcode.com/


As much as I like to distrust ML algorithms to give exact, reliable results, here I actually think that a random picture that aims to be a QR code that is also drawn manually will have much lower chance of QR code recognition code than ML-generated one, because it's hard to manually restrict the work so that it is reliably recognizable by many QR implementations while also "integrating" QR code features with art features so that they are not obviously two independent layers one laid on top of another.


It's costly to make such images, that's about it. Other way around you'd have to decide on the QR, wait for the commission, pay a substantial amount of money. Probably wouldn't even get such subtle codes either, this seems like straight up CV-trickery.


It's for sure brilliant.


Something I learned recently: the phrasing "QR Code" is a trademark of a company called Denso Wave, who invented them. While the method of producing and reading QR codes is free for all, (Denso Wave waived their rights to the patents) they still protect their trademark. This has lead many Japanese companies that use QR codes, to call them publicly something else, such as "2D codes", in fear of getting sued.


Huh. Turns out it's a subsidiary of the same Denso that's a massive automotive supplier and largely owned by Toyota. Asian conglomerates are so interesting.


IIRC they created them in the first place to make manufacturing easier


Nothing compared to european conglomerates, which do wastemanagment, auction horses and build fighter jets...


I dunno, marital aids (sorry, muscle massage wands) and nuclear reactors is a quirky mix.


> marital aids

Vibrators. Hitachi is also known for their powerful, corded vibrators (it's not a dirty word): the Magic Wand.

Calling these 'marital aids' in 2023 seems a little outdated. Vibrators are devices used for sexual stimulation, which obviously makes them extremely useful for solo masturbation as well, in addition to being a sex toy someone can use on another person.


Too right! Also great for men as well as women.

All magic wands are amazing (not just the hitachi ones, but try to find a decent brand like hitachi, bedgeek). Trust me guys, they're so good in many spots; treat yourself!


Vibrators have a lot of interesting heavy industrial uses. At massive scale, things like paint mixers are massive vibrators. I had a college friend whose job title on LinkedIn for many years was "Vibrator Engineer" due to specialization in that industrial field. I don't think any of the vibrators they worked on were "personal sized" and I doubt any of the companies on their resume had any plans to sell sex toys, but that was an industrial/mechanical engineering specialization important enough to those companies to be reflected even in job titles.

Relatedly, my favorite Japanese product line enigma remains Yamaha realizing that all the finely specialized industrial equipment for building organs and pianos could probably be multi-tasked to making motorcycles.


I have seen them called "Quick Scan Code" or something similar in some ads.


Interesting bit of info, thanks for sharing. Sadly for them, I think the genie is out of the bottle on this one; while I've seen a few people use alternate names, most call them QR codes.


In the Chinese world, it's still called the equivalent of 2D code in Chinese(二維碼/二维码). The original variant QR Code(QR碼/QR码) are used but to the best of my knowledge they are quite mixed together in terms of usage.

I think the mainland Chinese are more inclined to 2D code by the interactions with them in the past.


3D codes will be rad


Could be something like "2d barcode" that got shortened to "2d code" cause there was not really any bars.


I love how every news outlet reporting this will essentially be forced to link to the author's site if they want to include the image.


Imagine if some construction company created a whole neighborhood that from the right vantage point would be a valid QR code.


It's all fun and games... Until someone forgets to pay the annual domain fee.


A QR code on a yoghurt that I bought couple of months ago came with some interstitial ad due to an unpaid fee. It made me double check the yoghurt's expiration date.


Seems like nowadays links rot faster than yoghurt!


10/10, no notes!


Like those 800k or so Maryland drivers with starspangled200.org on their license plates.


A QR code is just data, it doesn't have to be a URL, it could just as easily be any kind of data


Realistically if you want to contain anything but short text or heavily compressed data URIs you need to be hosting it on a domain the code points to.


Fun to imagine in the abstract. I used to take classes in a building designed to have a certain appearance from above, and the user experience was definitely the worse for it



    1. Secretly repaint one wall of a house and redirect the qr code to a slightly different url
    2. ???
    3. Profit


Not possible -- QR codes have error correction.


Error correction doesn't make it impossible to change a message by flipping bits, you just have to change enough bits, and know which bits to flip. I wouldn't rule out, that if you are being smart about it, you might be able to change it into a different valid url, without having to change too many of the squares. You might even be able to use the error correction to your advantage to an extend.


Especially if we are gonna throw away half the error correction in an attempt to make artsy qr codes


You could use an unnecessarily big QR code for extra correction bits to mitigate this somewhat (up to the maximum correction standard (30%?) even if that means 41 cell code instead of a 33 cell one). For URLs another size hack is to include meaningless extra data (a qstring parameter or anchor that won't be interpreted). This doesn't increase the error protection in itself, but gives the fancier more data to work with so it can produce better visual results without losing more of the signal correction strength. Using the generator at https://qrbtf.com/ someone linked above, try the “C2” style with https://qrbtf.com/ and https://qrbtf.com/#some-extra-data-to-increase-the-image-siz... to see the difference this makes.

The issue with artsy QR codes often isn't the individual bit flips, but that they often include large areas of all black or all white which can make it harder for the reader to pick up the actually correct bits if the viewing angle and lighting aren't perfect. The standard includes 8 mask patterns that you can freely choose from, the intention being that you pick the one which gives most black/white variation in the final result, so there is as few low-contrast areas as possible. With improvements in cameras and processing built into QR scanners these days this is becoming less of a concern, but if you need your code to be reliably readable by older devices, probably stay away from the fancy tricks.

The fancy tricks are cool though, worth all the caveats if they match your stylistic needs.


I love seeing companies blindly encoding massive URLs into QR codes that end up being ridiculously detailed images. Like they would be impossible to scan unless you were right up close with a good camera because the individual dots are so small.


It is possible, you only have to replace also the correction stuff


Old Maxtor campus in Milpitas was supposed to look like an HDD https://goo.gl/maps/JbRWqZseAVL14n167


If you zoom out they are very recognizably QR codes. A commenter made the point that what you're seeing in that case is the low frequency component of the image. Kind of like the Marilyn Monroe / Albert Einstein illusion.


This kind of QR codes should work nice on big billboards


Beautiful work!

From the title I was expecting the QR codes to move, but they're actually "anime drawing style", not "anime"


Does that mean the accurate term would be "manga"?

I've never been sure if the only difference between the two is still frames vs motion, or something else.


There is, surprisingly, no correct labels exist for this class of images. Anime is incorrect because it’s not an animated film or directly derived from one, manga is kind of correct but modern definition is just panelists comics, nijigen is another term but it’s slightly deprecative, hentai is only for porn and also won’t be understood in Japanese. There just don’t seem to be one.


"Anime style" seems to be a decent compromise that is easily understood by most people, even if technically incorrect. AFAIK a similar term is often used in Japan: "アニメ風イラスト" (Anime style Illustration)


To the vast majority of people though, anime just means anime style. See for example the common term, anime profile picture. It's like the word meme, or irony, or begging the question.


My Japanese friend said "アニメのQRコード?" when I sent them this link, so I think that usage works in both languages.


> hentai is only for porn and also won’t be understood in Japanese

Can you expand on this? Why not?


I'm guessing bc "hentai" is only "pervet/weirdo/weird person", "ero" or "ero anime" is used for that in Japan, although I'm almost certain if you walk into a shop that sells it, and refer to it as "hentai" they'll know what you mean.


Assuming you mean a sex shop, 'hentai' would refer to basically the entire store's stock, so I think you'd need to be a bit more specific! It doesn't automatically refer to manga or anime like it does in the West.


AFAIK it is just the literally word for "pervert"


Well, they're "the style that image models called anime produce".

These mostly start with real-world images and then are fine-tuned with Chinese/Japanese commercial illustrator art, which isn't anime (flat-colored TV episode screenshots) or manga (monochrome halftoned comic book pages).

The result is like 15% photorealistic shaded, so it's not a lot like anything else out there.


“Anime” comes from the Japanese Katakana word for animation (animeeeshon), so it usually refers to the animated/moving images


Intriguing, why does it have a triple e when written - is it just a way to emphasize that the vowel is pronounced long, or is it reallly long?


It's a bit of an artifact of the "dash indicating long e":

アニメーション - a-ni-me-ee-ts(u)-yo-n

Just means long e "me". It could be written more like:

anime-tsyon (dash indicating long vowel). Or: a-ni-me-e-ts(u)-yo-n.


Three 'e's is not correct. ー is a single mora, so should usually be one vowel. E.g. ラーメン is raamen not raaamen.

ショ is sho (or syo if you use Japan-style romanization) not tsu.

So the proper romanisation is something like 'animeeshon'. That said, romanisation is often done inconsistently, e.g. Osaka vs. oosaka.


I just wanted to make it clear that its a long “e”, but pretty much the same word as “animation”, not the correct english spelling of an english-imported word :p


> ショ is sho (or syo if you use Japan-style romanization) not tsu.

Of course - I'm a little rusty and sometimes confuse シ (shi) and ツ (tsu) - even when obvious from context :/


What I've seen most is the line put above the vowel, resulting in animē (but difficult to type). As there is no additional (fourth) syllable, a-ni-mee would be more logical to me, rather than a-ni-me-ee or a-ni-me-e.

That being said, I like how the triple vowel makes it clear it's not the same sound as in say meet. (This gives me the idea to change my name to tuuukkkah...)


It's adopted from english?

Just sounds like how a japanese would write animation


Yeah that’s pretty much it. Katakana words are mostly just imported foreign words

There’s “moving images” (動画), but that’s used for video in general, not specific to animation


"Manga style drawing" would be misleading since manga are drawn in black and white.


But the cover art of manga is often colour. So it should still count as manga even if it has colour IMO


"Manga style drawing" would be generally understood to mean looking like 188/190 of the pages of a manga rather than looking like 2/190 of the pages of a manga.


Your pedantry is neither appropriate nor correct. Manga is most often black and white purely because of time and budget constraints, not because manga's style is defined as black and white. There are tons of full-color manga, and many that become popular have color editions released.


> Your pedantry

It's not pedantry. I'm trying to convey some actual understanding here. These drawings aren't manga-style, you can tell because they don't look like (typical) drawings from manga; most obviously in that they're not black and white.

> Manga is most often black and white purely because of time and budget constraints

True but irrelevant. The style of the medium coevolved with those constraints and is suited towards them (as with most media). A manga-style drawing is stylised in particular ways that (among other things) allow it to look better in black and white than a typical drawing would.

> There are tons of full-color manga, and many that become popular have color editions released.

They exist (indeed I own some) but they are the exception rather than the rule. Again, "manga-style drawing" would be generally understood to mean a drawing that looked like a typical drawing from a manga.


> "manga-style drawing" would be generally understood to mean a drawing that looked like a typical drawing from a manga.

Generally understood by who though?

I see your point about what you said about the colours

> manga-style drawing is stylised in particular ways that (among other things) allow it to look better in black and white than a typical drawing would.

In particular I agree that the black and white manga drawing uses special techniques to look good in black and white. Such as notably the half-tone patterns that they use.

But I think you are placing more weight on this particular thing than perhaps most people do.

There are many defining features of manga aside from the lack of colour.

I guess to determine whether or not it is generally agreed that it must be black and white, we’d have to interview a bunch of people about what style some images were, and see if an overwhelming majority thought that colour mattered or not :p

Or, less thoroughly we might just ask the denizens of the 4chan /a/ board. They probably have some strong opinions about what counts as manga or not.


I think it's less about black/white and more about the outlined art style. A lot of these QR codes are painted. There are painted manga (Lost in Abyss comes to mind) but they are a rarity.


Mostly, not always. For example, https://en.wikipedia.org/wiki/Colorful_(manga)


> From the title I was expecting the QR codes to move, but they're actually "anime drawing style", not "anime"

Given the description of the apparent technique, its likely trivial to extend it to animated QR codes using the same ControlNet models and ControlNet inputs and existing techniques of animating travel through prompt and/or seed space for StableDiffusion.


the scanned result redirects to qrbtf.com, which OP ported some QR libs into javascript [1]

notably they also implemented the "Halftone"[2] style.

[1] https://github.com/ciaochaos/qrbtf

[2] http://vecg.cs.ucl.ac.uk/Projects/SmartGeometry/halftone_QR/...


That is impressive. I know the images will have been selected for the fact that they are particularly good examples, but I've seen a number of implementations of trying to mix a photo into a “standard blocky code” (the girl and Trump examples on that page) and none previously produced results quite that good. I shall have to have a play.


> Next, they fed existing QR codes into the Stable Diffusion AI image generator and used ControlNet to maintain the QR code's data positioning despite synthesizing an image around it, likely using a written prompt.

A few months ago, after seeing that ChatGPT could produce reasonably accurate MD5 hashes, I tried generating QR codes with a Midjourney prompt. It failed in a really interesting way - it generated _symmetric_ QR codes, even though QR codes are explicitly designed to be asymmetric (think of the timing pattern, the three large blocks). So while I could claim ChatGPT "understood" MD5 hashes, I can't claim that Midjourney "understands" QR codes.

How long until generative models can produce working QR codes on their own?


Forget QR codes, until very recently Stable Diffusion and Co could not generate legible text in images.


Can they now? I had the impression that stabled diffusion is not moving forward that fast because the original team that built it is not the ones that are in stability.ai


some guy in /r/stablediffusion made a lora that can do that (or maybe a derivative model, dont remember which)


It's the human handwriting vs computer font problem. We can't expect a font out of ML, only handwriting.


Now, who wants to combine this with the tutorial from https://news.ycombinator.com/item?id=36173441 and decode one of those by hand? :)


This would pair excellently with a WiFi QR code for restaurants showing their Wifi password. (eg: <https://qifi.org>)



For the love of sanity, please don’t. In real life, I struggle enough to scan normal QR codes when the redundancy of error correction is here to… you know… correct errors and help the scanning process.


>This discovery opens up new possibilities for both digital art and marketing.

Like hiding malicious URLs in public.


Hah, even without the hacking angle, having URLs to promote shit popup when you point your camera somewhere could be the next obnoxious advertising.

For a few years now phone cameras have been able to automatically detect QR codes, maybe their next feature will be an option to turn off "smart features"...


It's all in preparation for Apple Vision. Everything you see will link to something...


The alignment squares here are a pretty big giveaway, and it seems like it'd be really difficult to fix that without making them unscannable


Or making QR codes harder to read on certain cameras or lighting conditions by removing the error correction!


I wonder if this would work by simply using out-painting to preserve the black dots, to make a background, and then use in-painting on the dots with the condition that they stay dark


Yes, both white and black dots though. So long as the 'central' 30% ish of each grid location is appropriately 'light' or 'dark', it will scan.


The use of controlnet to preserve the important parts of the QR code was genius here.


The internet is flooded with these in one day, but at least this one does not work for me (iPhone 12 mini), it does detect the face of the lady.

Edit: Ok, it does work at a larger distance.



I believe this will be widely adopted and quickly too! Fantastic work!


Working seems like a stretch. I can't get any of them to scan.


Which app are you using? For most of them I needed to get a few feet away, as mentioned in the article. For some it seemed I needed to be more exactly facing it, not angled. I got all of them to scan pretty easily.


I'm using the default camera on my phone. It's called "Camera". The phone is a Samsung Galaxy. I've tried it close, far, angled, straight, big, small. I haven't gotten any of them to work a single time.


Works mostly fine for me from Firefox on Android. All scans fine except one.


Working for with iPhone's scanner.


I guess the next step will be someone who converts themselves to a living QR code via plastic surgery and makeup.


My phone (Samsung S23U) couldn't read the first image.

It found the face, it found the text on the page, it highlighted sections in case I wanted to copy the image/text, but no QR response.


I would absolutely love to see these instead of regular QR codes everywhere


This is so insanely cool I don't even know where to begin.


You could try scanning it




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: