Compare commits

..

3 Commits

Author SHA1 Message Date
804b8a637b remove unnecessary volume 2025-07-20 18:55:10 +00:00
545f6479a6 pick random frame from gifs 2025-07-20 18:54:37 +00:00
f63a966d77 fix docker implementation 2025-07-20 18:28:26 +00:00

View File

@@ -27,7 +27,7 @@ highest_post = next(booru.search_post("sort:id type:image", page_size=1))
post = None
while post is None:
random_id = 10455 # For testing, always use ID=10455 which is a gif
random_id = random.randint(0, highest_post.id_)
temp_post = booru.getPost(random_id)
if temp_post and temp_post.mime.startswith("image/") and temp_post.content:
post = temp_post
@@ -65,7 +65,7 @@ while not image_downloaded:
# Find a new post
post = None
while post is None:
random_id = 10455 # For testing, always use ID=10455 which is a gif
random_id = random.randint(0, highest_post.id_)
temp_post = booru.getPost(random_id)
if temp_post and temp_post.mime.startswith("image/") and temp_post.content:
post = temp_post
@@ -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")