Compare commits
3 Commits
master
...
804b8a637b
Author | SHA1 | Date | |
---|---|---|---|
804b8a637b | |||
545f6479a6 | |||
f63a966d77 |
@@ -80,9 +80,9 @@ while not image_downloaded:
|
||||
# Process and upload
|
||||
img = Image.open("image.jpg")
|
||||
if post.mime == "image/gif":
|
||||
print("[DEBUG] Detected GIF, selecting random frame.")
|
||||
# Seek to a random frame
|
||||
random_frame_index = random.randint(0, img.n_frames - 1)
|
||||
print(f"[DEBUG] Detected GIF, selecting frame: {random_frame_index}")
|
||||
img.seek(random_frame_index)
|
||||
# Convert the frame to an RGB image to discard GIF palette and alpha for processing
|
||||
img = img.convert("RGB")
|
||||
|
Reference in New Issue
Block a user