我可以制作二维码来定位其 favicon.ico 吗?
具体来说,我想制作一个二维码 http://example.com 成为 http://example.com
可用分辨率是否足够好?我如何缩小它?我可以在缩小之前砍掉单像素白色边框吗?
我可以打包多个分辨率吗?如果可以,哪些浏览器会显示更高的分辨率?
Specifically I want to make a QR code to http://example.com be the favicon for all pages under http://example.com
Is the available resolution good enough? How do I scale it down? Can I chop off the single pixel white border before scaling down?
Can I pack multiple resolutions -- if so what browsers would show the higher resolutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
浏览器在 URL 栏中显示的网站图标为 16x16,这对于普通 QR 码 (25x25) 来说是不够的。您可以包含更高分辨率的网站图标,某些浏览器会在适当的位置显示它,但除非屏幕上的最终尺寸足够大以进行扫描,否则它不会对您有帮助。您可以在屏幕上看到可扫描代码所需的最小尺寸 此处。
Favicons that are displayed by the browser in the URL bar are 16x16 which is not enough for a normal QR code (25x25). You can include a better resolution favicon and some browsers will display it in places but unless the end size on screen is large enough to scan it won't help you. You can see the minimum size you would need on screen for a scan-able code here.
微型 QR 码也可用,其大小约为 15x15 或更多像素,但并非每个 QRcode 阅读器都可以读取它。
我尝试在我的主页上制作这个: http://tim.tom.ru
Micro QR code is also available, its size is about 15x15 and more px, but not every QRcode reader can read that.
I tried to make this one at my homepage: http://tim.tom.ru
我最终将可以生成 27x27 的最小 QR 码与另外 3 个尺寸 54x54、81x81 以及似乎默认的尺寸:108x108 捆绑在一起,使用 imagemagick 来打包它们,大致如下所述: http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
我没有缩放它们,因为至少 Chrome 和 Firefox 能够根据他们的需求进行扩展,这样我就不会冒弄乱二维码本身信息的风险。请注意,QR 码的尺寸为 27x27 的倍数,而图标的尺寸为 16x16 的倍数,因此在重新缩放时存在丢失信息的风险。
我不知道 IE 会发生什么,因为我无法访问它。
前面的答案错误地提到 25x25 作为图像的大小,因为它不包括每个尺寸上的白色像素边框,我不能认为这是多余的,因为它用于标记 QR 码的实际内容。
我没有研究删除 1 像素白色边框是否仍然可以让读者通过利用 QR 码中冗余的丢失容忍信息来读取各种背景下的 QR 码。
我不担心像素分辨率或扫描仪距离,并假设用户能够为这些因素创造理想的条件。
我可能有无用的 QR 码图标,因为它无法直接从浏览器栏上扫描,但是,嘿,从非 QR 角度来看,它是一个合法的图标,如果有人明确下载了 favicon.ico,那么他们确实可以访问到完整的二维码:-)
我接受我自己的答案,因为另一个答案不够充分,如果有人提出更好的答案,我将很乐意转而接受另一个答案:)
I ended up bundling the smallest QR code I could generate 27x27 together with 3 more sizes 54x54, 81x81, and what seemed to be the default: 108x108 using imagemagick to pack them up, roughly as described here: http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
I did not scale them because at least Chrome and Firefox were able to scale them to their needs, and this way I did not risk messing with the information in the QR code itself. Note that the QR codes go in multiples of 27x27 and the favicons go in multiples of 16x16, hence the risk of losing information when rescaling.
I do not know what happens with IE because I don't have access to it.
The previous answer incorrectly mentions 25x25 as the size of the image because it does not include the white pixel border on each size, which I cannot see as redundant because it serves a purpose in marking off the actual content of the QR code.
I did not research whether removing that 1-pixel white border can still allow a reader to read the QR-code against a variety of backgrounds by making use of the redundant loss-tolerance information in the QR-code.
I did not worry about pixel-resolutions or scanner distance and assumed that the user would be able to create ideal conditions for those factors.
I probably have useless QR-code favicon in the sense that it cannot be scanned right off the browser bar, but hey, it is a legitimate favicon from a non-QR perspective and if someone explicitly downloads the favicon.ico then they do have access to a full QR code :-)
I am accepting my own answer because the other one is less sufficient and I will be happy to switch to accepting another answer if someone comes up with a better one :)