On Wed, Feb 14, 2024 at 7:44 AM John R. Hogerhuis <[email protected]> wrote:

That's pretty cool. How many bits does the QR convey?
>
That’s a surprisingly complex question. The short answer is that this 21 x
21 pixel QR code could hold up to seventeen 8-bit binary characters.
(Phones seem to recognize the characters as standard Unix UTF-8 Unicode
encoding, which is a superset of ASCII where characters beyond ASCII use
two or more bytes.)

Longer answer: Besides having different sizes — from Version 1 at 21x21 to
Version 40 at 177 x 177 <https://www.qrcode.com/en/about/version.html> —
even at the same dimensions QR codes have various compression and error
correction modes which means the size of the payload varies. For example,
if the data was in all caps (plus some punctuation), a 21 x 21 QR can fit
25 characters, instead of just 17. If it was purely numeric, you could fit
41.

Longest answer: But, you asked for a measurement in bits, not characters,
which gets a bit hairier. Of the 441 bits (21×21) the Model T is showing,
here are the ingredients:
Usage Bits
Three 8x8 alignment patterns 192
…plus two 5 pixel dotted lines connecting them 10
…plus one black pixel at top right of lower left square 1
Format info (ECC level and mask pattern) 15
Format (Duplicate) 15
Error Correcting Code data 56
Length 8
Encoding 4
End 4
Seventeen 8-bit characters 136

So, how many bits are conveyed? It depends upon what you count, but I’ll
stick with 136.

You can play around with different setting at this nifty QR encoder:
http://www.ee.unb.ca/cgi-bin/tervo/qrcode.pl

Another question you might ask: How large of a QR code could a Model T
show, theoretically? IIRC, the Model 100 screen was 64 pixels high. QR code
sizes are called “versions” and Version 11 would fit at 61x61 pixels. Using
the lowest ECC level, Version 11 conveys 321 bytes.

On my Tandy 200, the screen is 128 pixels high, so theoretically one could
show a Version 27 (125x125) QR code which could contain 1465 bytes. At that
point, you'd want to calculate the QR code on the Model T as the bitmap
would take 1954 bytes of storage, at a minimum.

—b9

P.S. I notice that the ASCII Pixels pbm2ap.c
<http://www.club100.org/memfiles/index.php?&direction=0&order=nom&directory=Ken%20Pettit/AsciiPixels/pbm2ap>
program will happily generate images which are too long to store in a BASIC
string (255 characters). I do not know if that means there is some way to
actually display such images. I suspect not since the first byte of the
string is the length.

$ convert granite: -geometry 41x41 foo.pbm
$ ./pbm2ap foo.pbm foo.ap
PBM to AsciiPixels Converter
Version 1.0
Copyright 2017, Ken Pettit
BSD 3-clause license
Image size: X=41, Y=41
$ wc -c foo.ap268 foo.ap
$ cat foo.ap
APf3LLC&#^N$.3CJ[CJ$c^RB3+?D(nS$Cl0^bg$[x#C$bYTZ%#BC*a<e6*?_mC4m%[s=g>^m#6e!^*d&SVQbE$T\AaGB[ax#11$=B#sA5SBY&#&@#`nG@CRSF*aF;cba&2%JJr_q_D@c*b?&/B*+)_BZ*2S%]*a%/Te*_?&)SCVJJ$&E*aFXI$*T0bS?/'a\2;.)a&Q#BC<,`m_p+,@B[mf$c&[AKC$&cZ&+K+amCC<QmYpc2V1[TqQ2c\[<b;CSa:I*f&'n[-C$

Reply via email to