Created
February 27, 2021 22:34
-
-
Save diegogurpegui/34c079247af8a9c89ea132146fb59299 to your computer and use it in GitHub Desktop.
Export file to QR images (in 2kb parts)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################ | |
# Export a file to several QR files | |
# | |
# Requirements: | |
# - qrencode (https://github.com/fukuchi/libqrencode) | |
# | |
# How to use | |
# $ export_file_qr.sh name.of.your.file | |
############################################################################ | |
# Get args | |
sourceFile=$1 | |
# Split in files | |
split -b 2048 $sourceFile ${sourceFile}_ | |
# Iterate over each file and convert to QR | |
fileParts=(./${sourceFile}_[abcdef]*) | |
i=0 | |
for fileNamePart in "${fileParts[@]}" | |
do | |
newQRFileName=${sourceFile}-${i}.png | |
qrencode --size 6 --dpi 72 -o ${newQRFileName} < $fileNamePart | |
echo "Generated QR file: $newQRFileName" | |
((i=i+1)) | |
done | |
# now delete the "part" files | |
rm ${sourceFile}_[abcdef]* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment