Skip to content

Commit

Permalink
Use image format mapped by an extension dictionary, which requires Pi…
Browse files Browse the repository at this point in the history
…llow 9.4.0 to work properly.
  • Loading branch information
yak1ex committed May 24, 2024
1 parent d483316 commit f48b92a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fooocusapi/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def save_output_file(

if extension not in ['png', 'jpg', 'webp']:
extension = 'png'
image_format = Image.registered_extensions()['.'+extension]

if image_meta is None:
image_meta = {}
Expand All @@ -64,7 +65,7 @@ def save_output_file(
os.makedirs(os.path.dirname(file_path), exist_ok=True)
Image.fromarray(img).save(
file_path,
format=extension,
format=image_format,
pnginfo=meta,
optimize=True)
return Path(filename).as_posix()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ transformers==4.30.2
safetensors==0.3.1
accelerate==0.21.0
pyyaml==6.0
Pillow==9.2.0
Pillow==9.4.0
scipy==1.9.3
tqdm==4.64.1
psutil==5.9.5
Expand Down

0 comments on commit f48b92a

Please sign in to comment.