Automatically Naming the Screenshots to Steam

Automatically Naming the Screenshots to Steam

The Problem

I want to upload my own screenshot to steam, but I found that the methods I found are a bit tedious.

Steam expects screenshots to follow a specific naming convention in its screenshot and thumnails folders:

YYYYMMDDHHMMSS_N.jpg

Where:

  • YYYYMMDDHHMMSS is the timestamp
  • N is a sequence number
  • .jpg is the required file format

Solution

I wrote a Python script to automate this process

import os
import shutil
from PIL import Image
from datetime import datetime

def copy_images(source_folder, destination_folder, resize_thumbnails=True, thumbnail_size=(200, 125)):
    """
    Copy all image files from source folder to destination folder with timestamp-based naming.
    Optionally create thumbnails in a subfolder.
    
    Args:
        source_folder (str): Path to source folder containing images
        destination_folder (str): Path to destination folder
        resize_thumbnails (bool): Whether to create thumbnails
        thumbnail_size (tuple): Size for thumbnails if enabled
    """
    
    image_extensions = ('.jpg', '.jpeg', '.png', '.bmp', '.gif', '.tiff')
    
    os.makedirs(destination_folder, exist_ok=True)
    
    if resize_thumbnails:
        thumbnails_folder = os.path.join(destination_folder, 'thumbnails')
        os.makedirs(thumbnails_folder, exist_ok=True)
    
    copied_files = 0
    sequence_number = 1  # Starting sequence number
    
    # Get current timestamp in YYYYMMDDHHMMSS format
    timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
    
    for filename in os.listdir(source_folder):
        if filename.lower().endswith(image_extensions):
            source_path = os.path.join(source_folder, filename)
            
            try:
                new_filename = f"{timestamp}_{sequence_number}.jpg"
                destination_path = os.path.join(destination_folder, new_filename)
                
                with Image.open(source_path) as img:
                    if img.mode in ('RGBA', 'P'):
                        img = img.convert('RGB')
                    img.save(destination_path, 'JPEG', quality=95)
                    copied_files += 1
                    print(f"Saved: {new_filename}")
                    
                    if resize_thumbnails:
                        thumbnail_path = os.path.join(thumbnails_folder, new_filename)
                        thumb = img.copy()
                        thumb.thumbnail(thumbnail_size)
                        thumb.save(thumbnail_path, 'JPEG', quality=90)
                        print(f"Created thumbnail: {new_filename}")
                
                sequence_number += 1
                    
            except Exception as e:
                print(f"Error processing {filename}: {str(e)}")
    
    print(f"\nDone! Saved {copied_files} images to {destination_folder}")
    if resize_thumbnails:
        print(f"Created thumbnails in {thumbnails_folder}")

if __name__ == "__main__":
    # Example usage
    source = "C:\\Users\\miyas\\Pictures\\VRChat\\SELECT" # change to your path
    destination = "X:\\steam\\userdata\\861267303\\760\\remote\\438100\\screenshots" # change to your path

    copy_images(source, destination, resize_thumbnails=True)

How to Use the Script

  1. Install Requirements:

    pip install pillow
    
  2. Edit the Paths:

    • Change source to your screenshot folder
    • Change destination to your Steam screenshots folder (usually in steam/userdata/[yourID]/760/remote/[appID]/screenshots)
  3. Run the Script:

    python upload.py
    

    After the process done, restart steam and you will see the customized pictures in the screenshot manager.

Key Features

  1. Automatic Timestamping: Uses current time for proper Steam format
  2. Format Conversion: Converts all images to JPG automatically
  3. Thumbnail Generation: Creates 200x125 thumbnails in a subfolder
posted @ 2025-09-22 21:20  miyasaka  阅读(12)  评论(0)    收藏  举报