Kanashius Posted July 2, 2024 Posted July 2, 2024 (edited) This script allows the usage of the QRCode UDF (QRCode UDF) from the console. It allows the output of a QRCode to the console or as image file. When creating an image, another image can be provided to automatically draw into the middle of the qrcode. The size will be automatically adjusted depending on the "error correction level" The newest version is 1.1 Man page: Spoiler expandcollapse popup================================ QRCode generator - cli ================================ The QRCode generator cli provides a command line interface to generate qrcodes. It allows the user to print the qrcode to the console (if no destination path is provided) or to output the qrcode as an image. It also allows the addition of another image to be drawn ontop of the qrcode in the middle, with the size automatically adjusted accordingly to the error correction level (ECL). SYNOPSIS qrcodegenerator-cli [OPTION]... [INPUT TEXT] [OPTION]... [DESTINATION] [OPTION]... DESCRIPTION Generate a qrcode for the given input text. The qrcode is printed to the console, or if a DESTINATION is provided, the output is saved as an image to that DESTINATION. The INPUT TEXT is optional, but then it must be replaced with the flag -t/--text. The DESTINATION can be replaced with the flag -d/--out. -b, --background provide the desired value for the background. Image output: color as ARGB (Default "0xFFFFFFFF"). Console output: the desired character/string (Default " "). -c, --color provide the desired value for the foreground. Image output: color as ARGB (Default "0xFF000000"). Console output: the desired character/string (Default "#"). -d, --delimeter provide a character/string to seperate multiple lines. This sequence is then replaced in the input text by \n (@LF) This can be changed to \r\n (@CRLF) with the flsg -r. -e, --ecl provide the error correction level (ECL) (Default "4"). Possible values: Low (up to ~7% loss): 1 Medium (up to ~15% loss): 2 Quartile (up to ~25% loss): 3 High (up to ~30% loss): 4 -h, --help, help, /?, ? Show this help -i, --icon provide the path to an image. That image will then be drawn at the qrcode. It will be scaled to not be larger then the allowed ECL (see argument above). Image size in relation to the qrcode and with those ECLs: low 5%, medium 13%, quartile 23%, high 28%. Note: The icon will not be upscaled, if it is smaller. Note: You can change -s/--size to make the qrcode larger => more imagespace. -l, --linebreak provide the desired character/string to insert after every qrcode line (Default "\r\n" or "@CRLF"). This only works with console output. -m, --margin configure a border around the qrcode (Default "[0,0,0,0]"). Defined as integer values: [<Top>,<Right>,<Bottom>,<Left>] With image output, it defines the border in pixels. With console output, it defines the border above/below with "\r\n" (@CRLF) and to the left/right with spaces (" "). -r Toggle from \n (@LF) to \r\n (@CRLF), when using the --delimeter command. -s, --size provide the desired size for the output. Image output: Pixel per rectangle Console output: Character/String per rectangle NOTE (Image output): Increasing the size changes the output width/height. This also influences the size of a possible icon (-i/--icon). -t, --text provides an alternative to define the input text. This allows the user to be sure, the text is not misinterpreted as another argument. -o, --out provides an alternative to define the destination. This allows the user to be sure the destination is not misinterpreted as another argument. ERROR HANDLING If an error occurres, the program prints an error and exits with an error code. Exit codes: 1 - Missing arguments; at least the input text is required 2 - Parameter --ecl provided, but value is missing or not one of [1,2,3,4] 3 - Parameter --color provided, but value is missing 4 - Parameter --background provided, but value is missing 5 - Parameter --linebreak provided, but value is missing 6 - Parameter --icon provided, but value is missing or path does not exist 7 - Parameter --size provided, but value is missing or not an allowed value 8 - Parameter --margin provided, but value is missing or not an allowed value 9 - Parameter --out provided, but value is missing 10 - Parameter --delimeter provided, but value is missing 11 - Unknown parameter found 12 - QRCode generation failed. 13 - QRCode generation failed because of the input text being to large. Maybe try a lower error correction level (ECL). 14 - QRCode image file could not be saved. There may be a problem with the path. 15 - Icon image file could not be loaded as an image 16 - Drawing (image)/showing (console) the qrcode failed AUTHOR Kanashius Copyright ⌐ 2024 Kanashius (https://wwww.kanashius.com) Changelog: Spoiler v1.1: - Add Flag -d, --delimeter to allow for a delimeter string to be used to add linebreaks to the input text - Add Flag -r to toggle from \n (@LF) to \r\n (@CRLF), when using the --delimeter command. QRCodeGenerator-CLI.zip QRCodeGenerator-CLI-Executable.zip QRCodeGenerator-CLI_v1.1.zip QRCodeGenerator-CLI-Executable_v1.1.zip Edited July 16, 2024 by Kanashius funkey and robertocm 2 My Website: Kanashius Webside (Some of my Programs you can find there)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now