Skip to content

Directory mode silently skips .JPG/.PNG (case-sensitive extension check) #23

Description

@chirag127

Problem

Directory mode skips files with uppercase extensions (.JPG, .JPEG, .PNG) because the endswith check is case-sensitive. Common iPhone/Android/Windows camera outputs are .JPG and get silently ignored with no warning.

Steps

  1. mkdir photos && cp IMG_0001.JPG photos/ (uppercase extension, as produced by most cameras)
  2. split-image photos 2 2

Expected

Image tiled into 4 pieces.

Actual

Output: Splitting all images in directory: photos then Done! — file skipped silently, no tiles produced, no warning.

Cite

src/split_image/split.py:175:

if file.endswith(".jpg") or file.endswith(".jpeg") or file.endswith(".png"):

Fix: lowercase the extension before compare, e.g. if file.lower().endswith((".jpg", ".jpeg", ".png")). Also consider adding .webp, .bmp, .tiff (all Pillow-supported).

Environment

split-image 2.0.3 (setup.py), Pillow>=9.0.0, Python >=3.6, any OS.

Thanks for maintaining whiplashoo/split-image!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions