Skip to content

Add a quiet zone size parameter to the GetGraphic() method #701

Description

@0k0r0k

Hello

In the method:

public byte[] GetGraphic(int pixelsPerModule, bool drawQuietZones = true)
{
using var png = new PngBuilder();
var size = (QrCodeData.ModuleMatrix.Count - (drawQuietZones ? 0 : 8)) * pixelsPerModule;
png.WriteHeader(size, size, 1, PngBuilder.ColorType.Greyscale);
var scanLines = DrawScanlines(pixelsPerModule, drawQuietZones);
png.WriteScanlines(scanLines);
#if HAS_SPAN
ArrayPool.Shared.Return(scanLines.Array!);
#endif
png.WriteEnd();
return png.GetBytes();
}

the quiet zone size is set to 0 or 8, depending on the drawQuietZones flag.

I suggest adding the ability to specify the quiet zone size in the method parameter.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions