02-split-images-based-on-type-V01

Photography Workflow Documentation

Author

Yahya Nazer - ChatBizDB.Com

Published

2026.06.18

Image File Organizer - Professional Image Management Tool

1. Purpose

The Image File Organizer is a specialized tool designed to automatically sort and organize image collections by file type. This professional-grade utility addresses the common challenge of managing mixed image formats in photography workflows, digital asset management, and content organization.

Primary Functions

  • Automatic Type-Based Sorting: Intelligently categorizes images into format-specific folders (JPG, PNG, RAW, etc.)
  • Comprehensive Format Support: Handles both standard image formats and professional RAW camera files
  • Non-Destructive Organization: Creates organized copies while preserving original files untouched
  • Timestamped Archive Creation: Generates uniquely named output folders to prevent overwrites
  • Professional Workflow Integration: Supports photography studios, content creators, and digital asset managers

Ideal Use Cases

Photography Workflows

  • Mixed Format Shoots: Separate RAW files from processed JPEGs for efficient editing workflows
  • Client Deliverables: Organize final deliverables by format type for easy client access
  • Archive Management: Sort historical photo collections by format for storage optimization
  • Backup Preparation: Pre-organize files for format-specific backup strategies

Digital Asset Management

  • Content Libraries: Sort web graphics, print materials, and source files into appropriate categories
  • Format-Specific Processing: Group images for batch processing by format requirements
  • Storage Optimization: Organize files for format-appropriate compression and storage solutions
  • Team Collaboration: Create standardized folder structures for multi-user environments

Technical Applications

  • Quality Control: Separate different quality levels and formats for review processes
  • Conversion Workflows: Organize source files for batch format conversion operations
  • Platform Distribution: Sort images for platform-specific requirements (web vs. print vs. social media)
  • Compliance Management: Organize files according to format-specific retention policies

Key Benefits

  • Time Efficiency: Eliminates manual sorting of hundreds or thousands of image files
  • Error Reduction: Automated process prevents human sorting errors and missed files
  • Workflow Standardization: Creates consistent folder structures across projects and teams
  • Original Preservation: Maintains complete backup of source files during organization
  • Scalability: Handles collections from dozens to thousands of images efficiently

2. Inputs

Required Input

  • Source Directory: A folder containing mixed image files to be organized
    • Single-Level Processing: Organizes files from the selected folder only (does not process subfolders)
    • Mixed Format Support: Handles any combination of supported image formats
    • File Preservation: Original files remain completely unchanged in source location

Comprehensive Format Support

Standard Image Formats

  • JPEG: .jpg, .jpeg (compressed photographic images)
  • PNG: .png (lossless compression, transparency support)
  • GIF: .gif (animated graphics, limited color palette)
  • BMP: .bmp (Windows bitmap, uncompressed)
  • TIFF: .tiff, .tif (high-quality, professional imaging)
  • WebP: .webp (modern web format with superior compression)
  • SVG: .svg (scalable vector graphics)
  • ICO: .ico (icon files, multiple resolutions)

Professional RAW Camera Formats

  • Canon: .cr2, .cr3 (Canon Raw Version 2 and 3)
  • Nikon: .nef (Nikon Electronic Format)
  • Sony: .arw, .srf, .sr2 (Sony’s Alpha Raw format)
  • Fujifilm: .raf (Raw Format from Fujifilm)
  • Adobe: .dng (Digital Negative, open standard)
  • Olympus: .orf (Olympus Raw Format)
  • Panasonic: .rw2 (Raw Format Version 2)
  • Pentax: .pef (Pentax Electronic Format)
  • Samsung: .srw (Samsung Raw format)
  • Sigma: .x3f (Sigma’s X3F Raw format)
  • Leica: .rwl, .dng (Leica Raw formats)
  • Mamiya: .mef (Mamiya Electronic Format)
  • Phase One: .iiq (Intelligent Image Quality)
  • Hasselblad: .3fr (3F Raw format)
  • Generic RAW: .raw, .dcr, .kdc, .erf, .mos, .ptx, .pxn, .r3d, .fff, .k25, .cap, .dcs, .drf

File Extension Handling

  • Case Insensitive: All extensions work regardless of case (.JPG, .jpg, .Jpg, etc.)
  • Automatic Detection: File types determined by extension analysis
  • Unknown Format Handling: Non-image files are ignored without error

System Requirements

Software Dependencies

  • Python 3.6+: Modern Python installation required
  • Tkinter: GUI framework (included with most Python installations)
  • Standard Libraries: Built-in modules only (os, shutil, datetime, sys)

Hardware Requirements

  • Minimum: 1GB RAM, sufficient disk space for copies
  • Recommended: 2GB+ RAM for large collections
  • Storage: Requires free space equal to source folder size for copies
  • Performance: Processing speed approximately 100-500 files per minute

Operating System Compatibility

  • Windows: 10, 11 (all editions) with UTF-8 encoding support
  • macOS: 10.12+ (Sierra and newer)
  • Linux: Any modern distribution with Python 3.6+

3. Steps

Step 1: Environment Preparation

Verify Python Installation

python --version
# Expected output: Python 3.6.x or higher

Download and Prepare Script

  1. Save 03-split-images-based-on-type-v01.py to your preferred location
  2. Ensure the script file has appropriate permissions
  3. Navigate to the script directory in your terminal/command prompt

Step 2: Script Execution

Launch the Application

python 03-split-images-based-on-type-v01.py

Welcome Screen

The application displays: - Tool name and version information - Copyright and licensing details - Processing overview and step preview

Step 3: Interactive Folder Selection

Folder Selection Dialog

  1. GUI Dialog Appearance: A file browser dialog opens automatically
  2. Navigation: Browse to locate your source image folder
  3. Selection: Click on the folder containing your mixed image files
  4. Confirmation: Click “Select Folder” to proceed
  5. Validation: The system confirms your selection and displays the folder path

Selection Criteria

  • Choose the Root Folder: Select the main folder containing your images
  • Single-Level Processing: The tool processes files in the selected folder only
  • Mixed Content Handling: Non-image files in the folder are automatically ignored

Step 4: Automated Organization Process

The script performs five automated phases:

Phase 1: Folder Creation

  • Timestamp Generation: Creates unique timestamp in format YYYY-MM-DD--HH-MM
  • Output Folder Creation: Generates folder named [source-folder]-organized-[timestamp]
  • Location: Created in the same directory as your source folder
  • Example: Photos-organized-2025-07-10--14-30

Phase 2: File Discovery

  • Format Detection: Scans all files in source folder for supported image formats
  • Type Categorization: Groups files by format type (JPG, PNG, RAW, etc.)
  • Statistics Display: Shows count of files found for each format type
  • Progress Reporting: Real-time console output of discovery process

Phase 3: Subfolder Structure Creation

  • Type-Based Folders: Creates subfolder for each image format found
  • Naming Convention: Uses uppercase format names (JPG, PNG, RAF, etc.)
  • Dynamic Creation: Only creates folders for formats actually present
  • Structure Validation: Confirms successful folder creation for each type

Phase 4: File Copying Process

  • Preservation Copying: Uses shutil.copy2() to preserve file metadata and timestamps
  • Duplicate Handling: Automatically renames files with identical names using incremental numbering
  • Progress Tracking: Real-time display of copying progress for each format
  • Error Handling: Continues processing if individual files encounter issues

Phase 5: Completion Reporting

  • Statistics Summary: Displays total files copied and any errors encountered
  • Output Location: Provides full path to organized folder
  • GUI Confirmation: Pop-up dialog confirms successful completion

Step 5: Result Verification

Immediate Verification

  1. Console Summary: Review processing statistics in terminal output
  2. Folder Inspection: Navigate to the timestamped output folder
  3. Structure Validation: Confirm subfolder creation for each image type
  4. File Count Verification: Spot-check that file counts match discovery phase

Quality Assurance

  1. Original Preservation: Verify source folder remains unchanged
  2. Complete Transfer: Confirm all image files have been copied
  3. Organization Accuracy: Verify files are in correct format-specific folders
  4. Duplicate Resolution: Check that renamed duplicates are properly handled

4. Outputs

Primary Output Structure

The tool creates a comprehensive, organized directory structure:

[Source-Folder-Name]-organized-YYYY-MM-DD--HH-MM/
├── JPG/
│   ├── photo001.jpg
│   ├── photo002.jpg
│   └── vacation_sunset.jpg
├── RAF/
│   ├── DSCF1234.raf
│   ├── DSCF1235.raf
│   └── portrait_session_01.raf
├── PNG/
│   ├── logo_design.png
│   ├── screenshot_01.png
│   └── transparent_graphic.png
├── CR2/
│   ├── IMG_5678.cr2
│   └── wedding_ceremony_001.cr2
└── DNG/
    ├── edited_photo.dng
    └── converted_raw.dng

Naming Conventions and Structure

Timestamped Root Folder

  • Format: [original-folder-name]-organized-YYYY-MM-DD--HH-MM
  • Example: Summer_Photos-organized-2025-07-10--14-30
  • Purpose: Prevents overwriting existing organized folders
  • Location: Created at the same directory level as source folder

Format-Specific Subfolders

  • Naming: Uppercase format extensions (JPG, PNG, RAF, CR2, etc.)
  • Dynamic Creation: Only formats present in source folder get subfolders
  • Alphabetical Listing: Folders appear in alphabetical order in file browsers
  • Consistent Structure: Same organization pattern regardless of source content

File Naming and Duplicate Handling

  • Original Names Preserved: Files maintain their original names when possible
  • Duplicate Resolution: Automatic renaming for files with identical names
    • First Instance: photo.jpg → photo.jpg
    • Second Instance: photo.jpg → photo_1.jpg
    • Third Instance: photo.jpg → photo_2.jpg
    • Pattern: Continues with incremental numbering
  • Metadata Preservation: File creation dates, modification dates, and other metadata preserved

Detailed Output Examples

Example 1: Photography Studio Organization

Source: Client_Session_2025/ (mixed RAW and JPEG files)

Output: Client_Session_2025-organized-2025-07-10--14-30/

├── CR2/          (34 files - Canon RAW files)
├── JPG/          (127 files - processed images)
└── DNG/          (8 files - converted files)

Example 2: Web Design Asset Organization

Source: Website_Graphics/ (mixed web formats)

Output: Website_Graphics-organized-2025-07-10--14-30/

├── PNG/          (45 files - logos and graphics with transparency)
├── JPG/          (78 files - photographic content)
├── SVG/          (23 files - scalable vector icons)
├── WEBP/         (12 files - optimized web images)
└── GIF/          (6 files - animated elements)

Example 3: Archive Digitization Project

Source: Historical_Photos/ (mixed vintage and modern formats)

Output: Historical_Photos-organized-2025-07-10--14-30/

├── JPG/          (567 files - digitized prints)
├── TIFF/         (89 files - high-resolution scans)
├── PNG/          (23 files - restored images)
└── BMP/          (12 files - legacy format images)

Processing Reports and Statistics

Console Output Summary

📊 ORGANIZATION COMPLETE!
✅ Successfully copied: 156 files
📁 Organized folder: /Users/photographer/Photos-organized-2025-07-10--14-30

File Type Distribution:
   - JPG: 89 files
   - RAF: 34 files
   - PNG: 23 files
   - CR2: 10 files

Success Metrics

  • Total Files Processed: Complete count of successfully organized files
  • Format Distribution: Breakdown showing count per image format
  • Error Reporting: Details of any files that couldn’t be processed
  • Processing Time: Duration of organization process
  • Output Location: Full path to organized results

Professional Applications

Workflow Integration Benefits

  • Editing Efficiency: RAW files separated for processing, JPEGs ready for review
  • Storage Optimization: Format-specific compression and archival strategies
  • Team Collaboration: Standardized organization for multi-user access
  • Client Delivery: Clean, professional folder structure for client handoffs

Quality Assurance Features

  • Original Preservation: Source files remain completely untouched
  • Metadata Retention: File timestamps and properties preserved during copying
  • Duplicate Safety: Automatic handling prevents file loss from naming conflicts
  • Process Validation: Comprehensive reporting enables verification of results

Scalability and Performance

  • Large Collection Handling: Efficiently processes thousands of files
  • Memory Efficiency: Processes files individually to minimize RAM usage
  • Cross-Platform Reliability: Consistent results across operating systems
  • UTF-8 Support: Proper handling of international characters in filenames

Next Steps After Organization

  1. Verify Results: Confirm all files are properly organized and source folder is intact
  2. Format-Specific Processing: Apply appropriate workflows to each format type
  3. Archive Strategy: Implement backup procedures for organized structure
  4. Team Distribution: Share organized folders with appropriate team members
  5. Future Organization: Use same tool for consistent organization of new image collections```{r setup-run-cmd, include=FALSE}

Resources & Downloads

Download all Python scripts and resources from this book:

www.chatbizdb.com/python-book

All code examples, templates, and additional materials are available for download. Please do not share this link - Thank you.

Copyright © 2025 ChatBizDB.com. All rights reserved.


No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law.


For permission requests, write to the publisher at: Email us

Contact Us

If you have any question or comment please contact us at Email us and make sure you add python-book at the beginning of the subject.

[1] "Time taken to run the Quarto document: 0.09226393699646 seconds"