Skip to content

Commit

Permalink
Notify if dependencies are not met.
Browse files Browse the repository at this point in the history
  • Loading branch information
bartTC committed Aug 13, 2024
1 parent 7562276 commit d0c13e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qrcode/image/pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class PilImage(qrcode.image.base.BaseImage):
kind = "PNG"

def new_image(self, **kwargs):
if not Image:
raise ImportError("PIL library not found.")

back_color = kwargs.get("back_color", "white")
fill_color = kwargs.get("fill_color", "black")

Expand Down
3 changes: 3 additions & 0 deletions qrcode/image/pure.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class PyPNGImage(BaseImage):
needs_drawrect = False

def new_image(self, **kwargs):
if not PngWriter:
raise ImportError("PyPNG library not installed.")

return PngWriter(self.pixel_size, self.pixel_size, greyscale=True, bitdepth=1)

def drawrect(self, row, col):
Expand Down

0 comments on commit d0c13e0

Please sign in to comment.