-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG version often rasterized with gaps #197
Comments
I just stumbled upon PR #41 and the Maybe putting the option a bit more forward somehow, or enabling it by default, would be nice? Thank you! |
Instead, I would suggest to specify |
I found this thread because I was also having this issue too. While If I run However, the gaps come back when I embed that image into LibreOffice Draw: And they persist when I export the document as a PDF: Maybe this is a LibreOffice issue—the link you shared to the old inkscape issue makes it clear that rendering cases like this is non-trivial. I just thought I'd share my experience since it doesn't seem this issue is fully solved. |
Hello,
I've noticed that although the SVGs generated by qrencode seem quite reasonable, a large variety of programs/libraries displaying those rasterize them with gaps between the qrcode "squares" (I'm unsure about the correct terminology, I'll refer to the little dark blocks as the qrcode squares). You can find examples of this behaviour at the end of the report.
Arguably, the error lies with the SVG rasterizers, and is out of the scope of qrencode, since the svg produced is quite reasonable. However, it seems that this issue has been lying for a very long time and is probably not going to be fixed everywhere any time soon. In the meantime, this makes
qrencode --type SVG
pretty much useless, since the output won't be reliably displayed nicely.Proposed patch
I gave the issue a bit of thought, and although this doesn't seem completely satisfying (it looks way too much like duct tape), I believe that the best course would be to add a border to every square of eg. 5% of the square's size. From the limited experiments I made, it seems to fix the problem (at least on the few programs I tried), doesn't seem visually awkward, and doesn't prevent qrcode scanners to read the qrcode (again, very limited experiments so far).
If the fix seems reasonable to you, I could submit a PR.
Examples
I rendered a qrcode holding the string "foobar" for demo purposes, with qrencode 4.1.1, using the command
qrencode --type SVG --background ffffff00 "foobar"
. Here are screenshots of a few applications rendering it badly:Eog (Eye of Gnome), common software to display images:
Inkscape (svg editor):
After creating a PDF embedding the SVG qrcode with Inkscape,
Zathura, using the pdf backend
mupdf
:Firefox, using the pdf backend
pdfjs
:The text was updated successfully, but these errors were encountered: