Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from PIL import Image
- from io import BytesIO
- # Updated base URL and suffix for the new set of images
- base_url = "https://vexgateway.fastly.carvana.io/executions/105356595/FLOOR_CLEANER/cleaned/clean_"
- url_suffix = ".jpg?v=1705586461.054&crop=60.79p,51.29p,x18.27p,y29.79p&quality=75&optimize=medium&width=2000"
- images = []
- # Download images and provide console output
- for i in range(1, 64): # There are 63 images
- url = f"{base_url}{str(i).zfill(3)}{url_suffix}"
- print(f"Downloading image {i}...")
- response = requests.get(url)
- if response.status_code == 200:
- images.append(Image.open(BytesIO(response.content)))
- print(f"Image {i} downloaded successfully.")
- else:
- print(f"Failed to download image {i}")
- # Create GIF and provide console output
- if images:
- gif_filename = "output.gif"
- print("Creating GIF...")
- images[0].save(
- gif_filename,
- save_all=True,
- append_images=images[1:],
- duration=100, # duration between frames in milliseconds
- loop=0 # loop forever
- )
- print(f"GIF created successfully: {gif_filename}")
- else:
- print("No images to create GIF.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement