Compare commits
2
Commits
fd05b3d4c4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90184bff58 | ||
|
|
abdde2450d |
@@ -545,7 +545,7 @@ def generate(
|
||||
except (PermissionError, OSError, BlockingIOError):
|
||||
pass
|
||||
|
||||
def smart_mode(image_path: Path) -> str:
|
||||
def smart_mode(image_path: Path | io.BytesIO) -> str:
|
||||
is_dark = ""
|
||||
|
||||
with Image.open(image_path) as img:
|
||||
@@ -739,7 +739,7 @@ def generate(
|
||||
|
||||
return rendered_outputs
|
||||
|
||||
def seed_from_image(image_path: Path) -> Hct:
|
||||
def seed_from_image(image_path: Path | io.BytesIO) -> Hct:
|
||||
image = Image.open(image_path)
|
||||
pixel_len = image.width * image.height
|
||||
image_data = image.getdata()
|
||||
@@ -837,11 +837,13 @@ def generate(
|
||||
image_path = image_path or Path(WALL_PATH)
|
||||
|
||||
blob = scheme_thumb_from_db(str(DB_PATH), str(image_path))
|
||||
if blob is not None:
|
||||
open_thumb = lambda: io.BytesIO(blob)
|
||||
else:
|
||||
thumb_path = generate_thumbnail(image_path, THUMB_DIR)
|
||||
open_thumb = lambda: thumb_path
|
||||
|
||||
def open_thumb():
|
||||
if blob is not None:
|
||||
return io.BytesIO(blob)
|
||||
else:
|
||||
thumb_path = generate_thumbnail(image_path, THUMB_DIR)
|
||||
return thumb_path
|
||||
|
||||
seed = seed_from_image(open_thumb())
|
||||
name = "dynamic"
|
||||
|
||||
Reference in New Issue
Block a user