如何创建带有公司徽标的二维码图像

发布于 2024-09-12 01:22:54 字数 1536 浏览 7 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

抱猫软卧 2024-09-19 01:22:54

您可以尝试http://www.unitaglive.com/qrcode
它允许多种内容类型和大量定制,包括更改眼睛的颜色;使用图像作为背景;多种款式;阴影;冗余;等等,还允许您使用徽标,并且基于免费增值商业模式。免费计划无需注册

You can try http://www.unitaglive.com/qrcode.
It allows many content types and heavy customization, including changing the color of the eyes; using an image as the background; many styles; shadow; redundancy; and more, also allows you to use a logo and is based off a freemium business model. The free plan has no signup

饭团 2024-09-19 01:22:54

这是一个将生成 QR 码的网站,其中您的图像实际上嵌入为 QR 码的一部分,没有纠错。

http://research.swtch.com/qr/draw

有一些关于它是如何进行的信息如果您想自行实现自动化逻辑,请在此处完成。

http://research.swtch.com/qart

Here is a site that will generate a QR code with your image actually embedded as part of the QR code, no error correction.

http://research.swtch.com/qr/draw

There is some information about how it is done here if you wanted to look into implementing the logic yourself for automation.

http://research.swtch.com/qart

怀念你的温柔 2024-09-19 01:22:54

我创建了一个视频,展示如何使用开源 C# 库创建 QR 码,然后将您选择的徽标上传/嵌入到 QR 码中:

http://markhagan.me/Samples/Create_QR_Code_With_Logo_ASPNet

该视频只有 10 分钟长,结果是一个可以工作的 QR 码生成器。如果您不想花十分钟,这里是源代码:

首页:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="CodeCreator._default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="URL" runat="server"></asp:TextBox>
        <br /><br />
        <asp:FileUpload ID="LogoUpload" runat="server" />
        <br /><br />
        <asp:Button ID="CreateCode" runat="server" Text="Create QR Code" OnClick="CreateCode_OnClick" />
        <br /><br />
        <asp:Image runat="server" ID="QRImage" />
    </div>
    </form>
</body>
</html>

和代码隐藏:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using MessagingToolkit.QRCode.Codec;
using MessagingToolkit.QRCode.Codec.Data;
using System.Drawing;
using System.Drawing.Imaging;

namespace CodeCreator
{
    public partial class _default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void CreateCode_OnClick(object sender, EventArgs e)
        {
            string path = "c:\\code\\projects\\CodeCreator\\CodeCreator\\";
            QRCodeEncoder encoder = new QRCodeEncoder();

            encoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.H; // 30%
            encoder.QRCodeScale = 10;

            Bitmap img = encoder.Encode(URL.Text);
            LogoUpload.SaveAs(path + LogoUpload.FileName);

            System.Drawing.Image logo = System.Drawing.Image.FromFile(path + LogoUpload.FileName);

            int left = (img.Width / 2) - (logo.Width / 2);
            int top = (img.Height / 2) - (logo.Height / 2);

            Graphics g = Graphics.FromImage(img);

            g.DrawImage(logo, new Point(left, top));

            img.Save(path + "img.jpg", ImageFormat.Jpeg);

            QRImage.ImageUrl = "img.jpg";
        }
    }
}

I created a video showing how to use an open-source c# library to create a QR Code and then upload/embed a logo of your choosing into the QR Code:

http://markhagan.me/Samples/Create_QR_Code_With_Logo_ASPNet

The video is only 10 minutes long and the result is a working QR Code generator. In case you don't care to spend the ten minutes, here is the source code:

The front page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="CodeCreator._default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="URL" runat="server"></asp:TextBox>
        <br /><br />
        <asp:FileUpload ID="LogoUpload" runat="server" />
        <br /><br />
        <asp:Button ID="CreateCode" runat="server" Text="Create QR Code" OnClick="CreateCode_OnClick" />
        <br /><br />
        <asp:Image runat="server" ID="QRImage" />
    </div>
    </form>
</body>
</html>

And the code-behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using MessagingToolkit.QRCode.Codec;
using MessagingToolkit.QRCode.Codec.Data;
using System.Drawing;
using System.Drawing.Imaging;

namespace CodeCreator
{
    public partial class _default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void CreateCode_OnClick(object sender, EventArgs e)
        {
            string path = "c:\\code\\projects\\CodeCreator\\CodeCreator\\";
            QRCodeEncoder encoder = new QRCodeEncoder();

            encoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.H; // 30%
            encoder.QRCodeScale = 10;

            Bitmap img = encoder.Encode(URL.Text);
            LogoUpload.SaveAs(path + LogoUpload.FileName);

            System.Drawing.Image logo = System.Drawing.Image.FromFile(path + LogoUpload.FileName);

            int left = (img.Width / 2) - (logo.Width / 2);
            int top = (img.Height / 2) - (logo.Height / 2);

            Graphics g = Graphics.FromImage(img);

            g.DrawImage(logo, new Point(left, top));

            img.Save(path + "img.jpg", ImageFormat.Jpeg);

            QRImage.ImageUrl = "img.jpg";
        }
    }
}
与之呼应 2024-09-19 01:22:54

您可能需要查看 http ://contentdeveloper.com/2010/01/how-to-customize-qr-codes-with-your-brands-identity/(几天前我读过一些其他文章,但我可以找不到它们,尽管这也应该有效)...此外,我读到的一些内容建议使用最高的纠错级别。这样,条形码中的更多数据只是纠错数据。您可以放心覆盖此内容,只要您意识到如果条形码的其余部分损坏,您可能无法恢复数据。

不幸的是,这只会涉及大量的试验和错误。

祝你好运!

编辑:抱歉,我刚刚读到您希望它自动生成而不是编辑图像。

You may want to look at http://contentdeveloper.com/2010/01/how-to-customize-qr-codes-with-your-brands-identity/ (there were some other articles I read just a couple nights ago, but I can't find them, though this should work as well)...also, something I read suggested using the highest error correction level. This way, more of the data in the barcode is merely error-correction data. You can overwrite this with no worries, as long as you realize that if the rest of the barcode gets damaged, you may not be able to recover the data.

Unfortunately, it's just going to involve a bunch of trial and error.

Good luck!

EDIT: Sorry, I just read that you wanted it generated automatically rather than editing the image.

黒涩兲箜 2024-09-19 01:22:54

您还可以通过 LogoGrab 直接使用您的徽标。只需在 http://www.logograb.com/upload 上传您的徽标,链接您想要的任何内容您的徽标,让您的客户无论在哪里看到您的徽标都可以扫描它。

You can also use directly your logo with LogoGrab. Just upload your logo at http://www.logograb.com/upload, link any content you wish to your logo and let your customers scan your logo wherever they see it.

尛丟丟 2024-09-19 01:22:54

看看以下网站。它们允许您上传徽标或图形,并将其自动嵌入到二维码中。它们还支持颜色变化。

我相信 QR4 网站正在开发 API,以允许其他人在其网站中提供相同的服务。

希望以上链接有助于解决您的问题。

Have a look at the following sites. They allow you upload a logo or graphic and have it automatically embedded in the QR code. They also support color changes.

I believe the QR4 site is working on an API to allow others to offer the same services in their websites.

Hope the above links help in solving your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文