User:SnowyCinema/QR codes

I'm thinking of modeling a way to replicate QR code images into SVG files. The purpose of this would be to standardize our representation of QR codes on Wikisource, such as we already do with complex math equations, music sheets, etc.

QR codes will usually be in works from the early 2010s or later, since they became mainstream coinciding the early smartphone era, despite having been invented in the 1990s.

Proposed process



 * One time: Read the original QR code image (backend).
 * One time: Extract the following data:
 * URL
 * QR version
 * Data capacity
 * Error correction level


 * One time: Enter that information into a Wikisource template QR code, for example:
 * Dynamic: The template would dynamically produce an SVG file of the QR code without uploading it to Wikimedia Commons or anywhere else.

Proposed QR code template capabilities

 * Dynamically load a QR code based on the information provided above (usually this data is extracted from a QR code present on a scan, as detailed above).
 * Clicking on the image would automatically link you to the site that the QR code normally links to. This makes the QR code even more useful than it was in the original. (Sort of like how we make music sheets more usable than they originally were by allowing MIDI downloads.)
 * (Perhaps) allow users to download a JSON/XML/etc. file with the QR code metadata mentioned above, in case a reader wants to use that data themselves.

Python script attempt
The following script tries to take the image File:DOJ IER QR Code.jpg (downloaded locally on my system) and do the above process. Update: The below code actually works!!! Thank God!!! This will just read the text returned by a QR code from an image, into UTF-8 format.

Resources

 * QR code
 * mw:Extension:QRLite