Closed simonmau closed 7 years ago
Hi Simon,
the "QrCode"-class has already an overload which takes a Bitmap-object which will be printed on the QrCode.
public Bitmap GetGraphic(int pixelsPerModule, Color darkColor, Color lightColor, Bitmap icon=null, int iconSizePercent=15, int iconBorderWidth = 6, bool drawQuietZones = true)
By passing the Bitmap icon to the GetGraphics method the icon will be printed. By changing the iconSizePercent parameter you can set up how much percent of the QrCode image will be covered by the icon (Min=1, Max=100). Please keep in mind that the higher this value is, the harder it is for QrCode readers to read out the QrCoder's payload.
Hi !
I don't see any overload method for GetGraphic()
, which will take icon as svg string and it will generate SVG.
namespace QRCoder
{
public class SvgQRCode : AbstractQRCode, IDisposable
{
public SvgQRCode();
public SvgQRCode(QRCodeData data);
public string GetGraphic(int pixelsPerModule);
public string GetGraphic(int pixelsPerModule, Color darkColor, Color lightColor, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute);
public string GetGraphic(int pixelsPerModule, string darkColorHex, string lightColorHex, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute);
public string GetGraphic(Size viewBox, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute);
public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute);
public string GetGraphic(Size viewBox, string darkColorHex, string lightColorHex, bool drawQuietZones = true, SizingMode sizingMode = SizingMode.WidthHeightAttribute);
public enum SizingMode
{
WidthHeightAttribute = 0,
ViewBoxAttribute = 1
}
}
}
thank you !
Hi @iAmBipinPaul ,
the overload with the icon-parameter is only available for the "QRCode" rendering class. The "SvgQRCode"-class doesn't support icons right now. Have a look at this Wiki page to learn more about the different rendering classes: https://github.com/codebude/QRCoder/wiki/Advanced-usage---QR-Code-renderers
If you like to implement icon support for SvgQrCodes feel free to do so and sent a Pull Request later.
Hi @codebude ,
Thank you for you the info. I don't know about low level stuff for QR code (Image/SVG )
, I will try this when I will get free time and If it works will definitely send pull request.
Hi @iAmBipinPaul
Are you able to make similar to the starbucks qr code? Can you share the code to produce that qr
Hi , @hermanthotan I think I was able to place logo on qr code but not the svg. but now I do not have access to the code so .
Documentation says the image overload is present in Base64 renderer: https://github.com/codebude/QRCoder/wiki/Advanced-usage---QR-Code-renderers#23-base64qrcode-renderer-in-detail But in reality (v1.6.0) it is not there. Is it a typo in docs?
Update: https://github.com/codebude/QRCoder/blob/master/QRCoder/Base64QRCode.cs#L121 Looks like the necessary constructor is disabled for .NET6 and later. Sad.
Hi, is there a way to add a Logo to the QR Code?
Like http://goqr.me/_Resources/Persistent/c51e9cb94c6c3e953542c764bb97a0e1cf033ca3/qrcode-logo-design-starbucks.png