Python script to assist organizing AI-generated images by batch converting .jfif files to .jpg, using creation dates and sequential numbering for structured filenames.
-
ImageMagick (version 7+) installed and added to system's PATH for .jfif to .jpg conversion.
-
Python 3.8+ (uses datetime, subprocess, etc.)
-
Tested on Windows; see Description for cross-platform adaptation.
- The script assumes a folder structure demonstrated below. It is designed to be run at the project root level, processing all jfif files in immediate subdirectories except _JFIF_backups. Upon conversion of jfif files to jpg, the original jfif files are archived under a dated folder under _JFIF_backups, preserving tree structure.
C:\Generative-AI-Platform\
├── themename1\
│ ├── download.jfif
│ ├── download(1).jfif
│ └── download(2).jfif
├── themename2\
│ ├── download.jfif
│ └── download(1).jfif
└── _JFIF_backups\
└── 20260118_005612\
├── themename1\
│ ├── download.jfif
│ ├── download(1).jfif
│ └── download(2).jfif
└── themename2\
├── download.jfif
└── download(1).jfif
-
Date extraction uses os.path.getctime to match Windows File Explorer creation date. Script should be adapted to non-Windows platforms using according dates.
-
Script converts and moves files, risking data changes or loss on errors. Use at own risk.
Command Line Switches
- Optional path argument: Specify a root directory (defaults to current working directory)
Example: Run from current directory
python jfif-batchconverter.py
Example: Run on a specific root path
python jfif-batchconverter.py C:\ProjectDirectory
Console/Log Output (Successful Run)
Script started. Root: C:\Generative-AI-Platform. Backup dir: C:\Generative-AI-Platform\_JFIF_backups\20260118_005612. Log: C:\Generative-AI-Platform\_JFIF_backups\20260118_005612\20260118_005612.log
Found 5 .jfif files across 2 themes: themename1 (3), themename2 (2)
Continue with conversion? [y/n]: y
Processing theme: themename1
File download.jfif creation date (local): 2026-01-06 23:34:33 EST
Converting download.jfif to themename1_20260106_001.jpg
Success: Moved download.jfif to backup
Summary: 5 successes, 0 failures. Backups in C:\Generative-AI-Platform\_JFIF_backups\20260118_005612
Generated Files
- Converted:
themename1_20260106_001.jpg(in original theme dir) - Backup: Moved original .jfif to
_JFIF_backups\YYYYMMDD_HHmmss\themename1\download.jfif
View source: jfif-batchconverter.py
This Python script is released under the MIT License.
X: @5ynthaire
GitHub: https://github.com/5ynthaire
Mission: Transcending creative limits through human-AI synergy
Attribution: Created with Grok 4.1 by xAI (no affiliation).