Skip to content

Commit

Permalink
feat: Support HEIF, HEIC and AVIF recipe image uploads (#3409)
Browse files Browse the repository at this point in the history
* feat: Support HEIF, HEIC and AVIF recipe image uploads

* fix: lint import block

* fix: avif now included

* fix: lint import block
  • Loading branch information
tba-code authored Apr 4, 2024
1 parent eb1d569 commit 9fade36
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 2 deletions.
6 changes: 5 additions & 1 deletion mealie/pkgs/img/minify.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
from pathlib import Path

from PIL import Image
from pillow_heif import register_avif_opener, register_heif_opener

register_heif_opener()
register_avif_opener()

WEBP = ".webp"
FORMAT = "WEBP"

IMAGE_EXTENSIONS = {".jpg", ".jpeg", ".png", ".webp"}
IMAGE_EXTENSIONS = {".jpg", ".jpeg", ".png", ".webp", ".heic", ".avif"}


def get_format(image: Path) -> str:
Expand Down
1 change: 1 addition & 0 deletions mealie/pkgs/img/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
".dib",
".heif",
".heic",
".avif",
".ind",
".jp2",
".svg",
Expand Down
71 changes: 70 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ authlib = "^1.3.0"
html2text = "^2024.0.0"
paho-mqtt = "^1.6.1"
pydantic-settings = "^2.1.0"
pillow-heif = "^0.16.0"

[tool.poetry.group.postgres.dependencies]
psycopg2-binary = { version = "^2.9.1" }
Expand Down

0 comments on commit 9fade36

Please sign in to comment.