Skip to content

Commit a8f49dd

Browse files
change from PNG to WEBP file format for downloads
1 parent 586ddc7 commit a8f49dd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ file_paths = dalle.generate_and_download("portal to another dimension, digital a
6565
...task not completed yet
6666
...task not completed yet
6767
🙌 Task completed!
68-
✔️ Downloaded: C:\...\generation-XySidj4N8EN6Ok9ed15BZ2bs.png
69-
✔️ Downloaded: C:\...\generation-IK3UdxDz77FA5SLKpQPIITdU.png
70-
✔️ Downloaded: C:\...\generation-uNejKBXz1z6EQxJAT9pAZbof.png
71-
✔️ Downloaded: C:\...\generation-Ol1wEqNprf34vNohmJz0iUiE.png
68+
✔️ Downloaded: C:\...\generation-XySidj4N8EN6Ok9ed15BZ2bs.webp
69+
✔️ Downloaded: C:\...\generation-IK3UdxDz77FA5SLKpQPIITdU.webp
70+
✔️ Downloaded: C:\...\generation-uNejKBXz1z6EQxJAT9pAZbof.webp
71+
✔️ Downloaded: C:\...\generation-Ol1wEqNprf34vNohmJz0iUiE.webp
7272
```
7373

7474
## Generate a specific number of images
@@ -122,7 +122,7 @@ image_rgba.save('image_with_transparent_right_half.png')
122122
# ask DALL·E to fill-in the transparent right half
123123
generations = dalle.generate_from_masked_image(
124124
"portal to another dimension, digital art",
125-
"image_with_transparent_right_half.png",
125+
"image_with_transparent_right_half.webp",
126126
)
127127
```
128128

src/dalle2/dalle2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def download(self, generations, image_dir=os.getcwd()):
9999
file_paths = []
100100
for generation in generations:
101101
image_url = generation["generation"]["image_path"]
102-
file_path = Path(image_dir, generation['id']).with_suffix('.png')
102+
file_path = Path(image_dir, generation['id']).with_suffix('.webp')
103103
file_paths.append(str(file_path))
104104
urllib.request.urlretrieve(image_url, file_path)
105105
print(f"✔️ Downloaded: {file_path}")

0 commit comments

Comments
 (0)