Python, Automation, Data Science, Artificial Intelligence, Llm.
for filename in os.listdir(image_directory): if filename.endswith('.png') or filename.endswith('.bmp'): # Open the image image_path = os.path.join(image_directory, filename) image = Image.open(image_path) # Convert the image to JPEG format new_filename = os.path.splitext(filename)[0] + '.jpg'