Package: rmqrcode
Rectangular Micro QR Code (rMQR Code) GeneratorThe rMQR Code is a rectangular two-dimensional barcode. This is easy to print in narrow space compared to conventional QR Code. This package can generate an rMQR Code image. This is implemented based onISO/IEC 23941: Rectangular Micro QR Code (rMQR) bar code symbology specification.🎮 Online Demo SiteYou can try this online:https://rmqr.oudon.xyz.📌 NoticeTo read rMQR code, we can useQRQR app. However many other QR code readers may have not been supported yet.Please verify an image generated by this software whether it can decode correctly before use.🚀 Installationpip install rmqrcode📕 Basic UsageCLIGenerate an rMQR Code image from your command line, usermqrcommand:rmqr"Text data""my_qr.png"See the help to list the options:➜rmqr-h
usage:rmqr[-h][--ecc{M,H}][--versionVERSION][--fit-strategy{min_width,min_height,balanced}]DATAOUTPUT

positionalarguments:DATADatatoencode.OUTPUTOutputfilepath

optionalarguments:-h,--helpshowthishelpmessageandexit--ecc{M,H}Errorcorrectionlevel.(default:M)--versionVERSIONrMQRCodeversionlike'R11x139'.--fit-strategy{min_width,min_height,balanced}StrategyhowtodeterminerMQRCodesize.Generate rMQR Code in scriptsAlternatively, you can also use in python scripts:fromrmqrcodeimportrMQRimportrmqrcodedata="https://oudon.xyz"qr=rMQR.fit(data,ecc=rmqrcode.ErrorCorrectionLevel.M,fit_strategy=rmqrcode.FitStrategy.MINIMIZE_WIDTH)Theeccparameter is an enum value ofrmqrcode.ErrorCorrectionLevelto select error correction level. The following values are available:ErrorCorrectionLevel.M: Approx. 15% Recovery Capacity.ErrorCorrectionLevel.H: Approx. 30% Recovery Capacity.Thefit_strategyparameter is enum value ofrmqrcode.FitStrategyto specify how to determine size of rMQR Code. The following values are available:FitStrategy.MINIMIZE_WIDTH: Try to minimize width.FitStrategy.MINIMIZE_HEIGHT: Try to minimize height.FitStrategy.BALANCED: Try to keep balance of width and height.Here is an example of images generated by each fit strategies for dataTest test test:Save as imagefromrmqrcodeimportQRImageimage=QRImage(qr,module_size=8)image.show()image.save("my_qr.png")📙 Advanced UsageSelect rMQR Code size manuallyTo select rMQR Code size manually, userMQR()constructor.fromrmqrcodeimportrMQR,ErrorCorrectionLevelqr=rMQR('R11x139',ErrorCorrectionLevel.H)R11x139means 11 rows and 139 columns. The following table shows available combinations.2743597799139R7❌✅✅✅✅✅R9❌✅✅✅✅✅R11✅✅✅✅✅✅R13✅✅✅✅✅✅R15❌✅✅✅✅✅R17❌✅✅✅✅✅Encoding Modes and SegmentsThe rMQR Code has the four encoding modes Numeric, Alphanumeric, Byte and Kanji to convert data efficiently. We can select encoding mode for each data segment separately.
The following example shows how to encode data "123Abc". The first segment is for "123" in the Numeric mode. The second segment is for "Abc" in the Byte mode.
We can select an encoding mode by passing theencoder_classargument to therMQR#add_segmentmethod. In this example, the length of bits after encoding is 47 in the case combined with the Numeric mode and the Byte mode, which is shorter than 56 in the Byte mode only.fromrmqrcodeimportrMQR,ErrorCorrectionLevel,encoderqr=rMQR('R7x43',ErrorCorrectionLevel.M)qr.add_segment("123",encoder_class=encoder.NumericEncoder)qr.add_segment("Abc",encoder_class=encoder.ByteEncoder)qr.make()The value forencoder_classis listed in the below table.ModeValue of encoder_classCharactersNumericNumericEncoder0-9AlphanumericAlphanumericEncoder0-9 A-Z \s $ % * + - . / :ByteByteEncoderAnyKanjiKanjiEncoderfrom 0x8140 to 0x9FFC, from 0xE040 to 0xEBBF in Shift JIS valueOptimal SegmentationTherMQR.fitmethod mentioned above computes the optimal segmentation.
For example, the data "123Abc" is divided into the following two segments.Segment No.DataEncoding ModeSegment1123NumericSegment2AbcByteIn the case of other segmentation like "123A bc", the length of the bit string after
encoding will be longer than the above optimal case.🤝 ContributingAny suggestions are welcome! If you are interesting in contributing, please readCONTRIBUTING.📚 ReferencesRectangular Micro QR Code (rMQR) bar code symbology specification: ISO/IEC 23941rMQR Code | QRcode.com | DENSO WAVECreating a QR Code step by stepThe word "QR Code" is registered trademark of DENSO WAVE Incorporated.http://www.denso-wave.com/qrcode/faqpatent-e.html