Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow correct spelling of parameters. #383

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ circles by reducing this less than the default of ``Decimal(1)``.

The ``StyledPilImage`` additionally accepts an optional ``color_mask``
parameter to change the colors of the QR Code, and an optional
``embeded_image_path`` to embed an image in the center of the code.
``embedded_image_path`` to embed an image in the center of the code.

Other color masks:

Expand All @@ -232,7 +232,7 @@ and an embedded image:

img_1 = qr.make_image(image_factory=StyledPilImage, module_drawer=RoundedModuleDrawer())
img_2 = qr.make_image(image_factory=StyledPilImage, color_mask=RadialGradiantColorMask())
img_3 = qr.make_image(image_factory=StyledPilImage, embeded_image_path="/path/to/image.png")
img_3 = qr.make_image(image_factory=StyledPilImage, embedded_image_path="/path/to/image.png")

Examples
========
Expand Down
15 changes: 11 additions & 4 deletions qrcode/image/styledpil.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ class StyledPilImage(qrcode.image.base.BaseImageWithDrawer):

def __init__(self, *args, **kwargs):
self.color_mask = kwargs.get("color_mask", SolidFillColorMask())
embeded_image_path = kwargs.get("embeded_image_path", None)
self.embeded_image = kwargs.get("embeded_image", None)
self.embeded_image_ratio = kwargs.get("embeded_image_ratio", 0.25)
embeded_image_path = kwargs.get(
"embeded_image_path",
kwargs.get("embedded_image_path", None))
self.embeded_image = kwargs.get(
"embeded_image",
kwargs.get("embedded_image", None))
self.embeded_image_ratio = kwargs.get(
"embeded_image_ratio",
kwargs.get("embedded_image_ratio", 0.25))
self.embeded_image_resample = kwargs.get(
"embeded_image_resample", Image.Resampling.LANCZOS
"embeded_image_resample",
kwargs.get("embedded_image_resample", Image.Resampling.LANCZOS)
)
if not self.embeded_image and embeded_image_path:
self.embeded_image = Image.open(embeded_image_path)
Expand Down