-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for base64 encoded images
Reviewed-by: Jon Dufresne
- Loading branch information
1 parent
5b4a3fa
commit e146726
Showing
4 changed files
with
101 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
import pathlib | ||
from io import BytesIO | ||
|
||
from PIL import Image | ||
|
||
TEST_DIR = pathlib.Path(__file__).parent.resolve(strict=True) | ||
PROJECT_DIR = TEST_DIR.parent | ||
DPI = 72 | ||
|
||
|
||
def generate_image(width: int, height: int, dpi=(DPI, DPI)) -> BytesIO: | ||
data = BytesIO() | ||
with Image.new("L", (width, height)) as image: | ||
image.save(data, format="png", dpi=dpi) | ||
return data |