Question:
Why 1 photo won’t convert with others?
In this image processing exercise other images convert every time, BUT 1 photo won’t (at first it was always bulbasaur, now it is suddenly pikachu).
OR all might convert if I have a mistake with the .jpeg .png endings.
Based on terminal output the loop has gone through all photos.
Repl link:
replit.com/@Monco-Carser/Image-processing-exercise#main.py
code snippet
import os
from PIL import Image
#check if /newimages exists and if not, create it
files = os.listdir()
if "newimages" not in files:
os.mkdir("newimages")
#loop through the Pokedex, convert photos, save in new location
for filename in os.listdir("Pokedex"):
img = Image.open(f"Pokedex/{filename}")
clean_name = os.path.splitext(filename)[0]
img.save(f"newimages/{clean_name}.png", "png")
print(f"{clean_name} done")