Compare commits

..

2 Commits

Author SHA1 Message Date
28cc8b2ed1 pick random frame from gifs 2025-07-20 19:00:26 +00:00
a5bf821186 fix docker implementation 2025-07-20 18:59:02 +00:00

View File

@@ -80,9 +80,9 @@ while not image_downloaded:
# Process and upload # Process and upload
img = Image.open("image.jpg") img = Image.open("image.jpg")
if post.mime == "image/gif": if post.mime == "image/gif":
print("[DEBUG] Detected GIF, selecting random frame.")
# Seek to a random frame # Seek to a random frame
random_frame_index = random.randint(0, img.n_frames - 1) 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) img.seek(random_frame_index)
# Convert the frame to an RGB image to discard GIF palette and alpha for processing # Convert the frame to an RGB image to discard GIF palette and alpha for processing
img = img.convert("RGB") img = img.convert("RGB")