Comments (15)
I'm sorry I have never used Colab nor I know what it's used for, so I don't know.
from qrgen.
Unfortunately, I never used Nim.
Probably Colab should work, at least it shows the version of the installed Nim:
!pip install git+https://github.com/demotomohiro/nim4colab.git
%load_ext nim4colab
%%nimc
echo "Nim version is ", NimVersion
Installing Nim stable
done
Hint: used config file '/root/nim-stable/nim/config/nim.cfg' [Conf]
Hint: used config file '/root/nim-stable/nim/config/config.nims' [Conf]
.........................................................
CC: nim-stable/nim/lib/std/private/digitsutils.nim
CC: nim-stable/nim/lib/system/dollars.nim
CC: nim-stable/nim/lib/system/io.nim
CC: nim-stable/nim/lib/system.nim
CC: code.nim
Hint: [Link]
Hint: gc: refc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
26647 lines; 1.341s; 31.695MiB peakmem; proj: /root/code.nim; out: /root/code [SuccessX]
Hint: /root/code [Exec]
Nim version is 1.6.11
But I don't know how to run nimble install
, it returns the error undeclared identifier: 'nimble'
:
%%nimc
nimble install qrgen
Hint: used config file '/root/nim-stable/nim/config/nim.cfg' [Conf]
Hint: used config file '/root/nim-stable/nim/config/config.nims' [Conf]
.........................................................
/root/code.nim(1, 1) Error: undeclared identifier: 'nimble'
candidates (edit distance, scope distance); see '--spellSuggest':
(3, 2): 'File' [type declared in /root/nim-stable/nim/lib/system/io.nim(21, 3)]
(3, 2): 'nimvm' [let declared in /root/nim-stable/nim/lib/system.nim(529, 5)]
from qrgen.
I managed to run it
%nimble -y install qrgen
%%nimc
import QRgen
let myQR = newQR("https://github.com/aruZeta/QRgen")
myQR.printTerminal
from qrgen.
Just wondering, have you tested the reliability of qr codes with pictures? What parameters should be used to create a qr code so that it works 100% of the time with all phones?
myQR.renderImg("#1d2021","#98971a",100,100,25,img=readImage("QRgen-logo.png"))
from qrgen.
The problem is not the phone but the QR scaner used, depending on the scanner it may or may not read complicated QR codes, like ones with rounded corners, spacing or even images.
Also the image should not be a problem since it calculates it's max size depending on the selected ECC level, so the amount of broken bits can be recovered.
from qrgen.
For some reason printSvg
doesn't work. Is there any way to save the svg to a file?
import QRgen
let myQR = newQR("https://github.com/aruZeta/QRgen")
myQR.printSvg
/root/code.nim(3, 5) Error: expression 'printSvg(myQR, "#ffffff", "#000000", 0, 0, 0, "qrCode", "", "",
genDefaultCoords(myQR), false)' is of type 'string' and has to be used (or discarded); start of expression here: /root/code.nim(2, 1)
from qrgen.
Yes, printSvg
returns you a string, so you just need to pipe it into a file, take a look to the tests file tests/testQRGen.nim
, here is an example:
let qr = newQR("https://github.com/aruZeta/QRgen")
writeFile(
"build" / "testingSvg.svg",
qr.printSvg
)
from qrgen.
How do you get this qr code? I would like to remove the dots around the logo as in your example.
!wget -O logo.svg https://upload.wikimedia.org/wikipedia/commons/b/b8/YouTube_play_button_icon_%282013%E2%80%932017%29.svg
%%nimc
import QRgen
let qr = newQR("https://github.com/aruZeta/QRgen", ecLevel=qrECH)
writeFile("testingSvg.svg", qr.printSvg("#1d2021", "#98971a", 100, 100, 25, svgImg=readFile("logo.svg")))
from qrgen.
Yes, that's intended behaviour, to avoid it you would just add a non-transparent background to your image, but oh well there should be a way to force a square to be drawn behind it.
from qrgen.
Do you mean that all the svg need to be specially edited by placing them on an non-transparent background rectangle of the same color as the background of the qr code? Also, the size of this rectangle must be manually adjusted for each qr code so that its borders do not partially overlap the dots of the qr code itself and do not divide them into two parts, right?
from qrgen.
The current implementation does not offer a way to force a background for transparent images.
About the size, you don't need to mind it since it's actually calculated to fit perfectly (and you can even force an x,y
position and a width,height
, although not recommended since it could mess up the QR code and make it unreadable unless you test it or know what you're doing).
from qrgen.
Is there any reason why you can't get a qr code like this without editing the svg and placing it on an opaque background?
from qrgen.
As I said it's not that there is a reason of why you can't force a layer between the QR and the image, so as in a way to act as the background of the image, but that it's just not implemented.
It shouldn't be a difficult task, but I will try it whenever I have the time and energy to do it.
from qrgen.
I see, thank you. Anyway, you did a very good job. And it would be absolutely perfect if you manage to add a way to force a background for transparent images.
from qrgen.
Yeah it's something that's missing from the library, but I'm very sorry I don't have any time atm.
from qrgen.
Related Issues (20)
- Add more print options HOT 1
- Create a README HOT 1
- Add svg QR code default fill colors
- Rounded alignment patterns in generated SVGs HOT 1
- Separate modules in smaller modules HOT 5
- Move print procedures to DrawedQRCode.nim module
- Better import organization HOT 7
- Fix `GcUnsafe` warnings HOT 1
- Windows "cannot find encoding ISO 8859-1" HOT 14
- Document the code
- Compile to JS HOT 4
- Create images png/jpg HOT 5
- Customize documentation generation HOT 4
- Having an issue with compiling to JS HOT 10
- Organize the code better HOT 6
- Write better code HOT 2
- Use a nix flake instead of shell.nix HOT 1
- Add the ability to render to SVG HOT 4
- Add GitHub action to check if tests pass HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qrgen.