Skip to content

Add option to set PNG QR code background color #203

@anuragckiocod

Description

@anuragckiocod

Currently, when generating QR codes with DNS2D::getBarcodePNG(), the PNG output has a transparent background by default. It would be useful to allow specifying a background color directly during generation, to avoid additional GD processing.

Expected behavior:

The function should accept a new optional parameter for background color:
$png = DNS2D::getBarcodePNG($code, $type, $width, $height, $color, $backgroundColor);

Generated PNG should have the specified background color (default: transparent if not provided).

Use case / Benefit:

  • Avoids having to post-process PNGs with GD to add a white background.

  • Useful for printing, marketing campaigns, or when transparent PNGs are not supported.

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