add for jpg also: for filepath in glob.glob(os.path.join(INPUT_FOLDER, "*.png")):
- User
add for jpg also: for filepath in glob.glob(os.path.join(INPUT_FOLDER, "*.png")):
- Assistant
You can make it handle both .png and .jpg files by either: ✅ Option 1: Add another loop pythonCopyEditfor filepath in glob.glob(os.path.join(INPUT_FOLDER, "*.png")): # process file here
for filepath in glob.glob(os.path.join(INPUT_FOLDER, "*.jpg")): # process file here
✅ Option 2: Use a tuple in glob pythonCopyEditfor ext in (".png", ".jpg", "*.jpeg"): for filepath in glob.glob(os.path.join(INPUT_FOLDER, ext)): # process file here
✅ Option 3: Use glob with braces (if using glob2 or pathlib) pythonCopyEditfrom pathlib import Path
for filepath in Path(INPUT_FOLDER).glob("*.{png,jpg,jpeg}"): # process file here
👉 If you’re sticking to the standard glob, I recommend Option 2, since it keeps everything in a single loop. Do you want me to also extend it for .jpeg automatically (some images may come in that format)?