>>11294nothing that a python script can't fix
install python (x64 installer):
https://www.python.org/downloads/windows/install PIL/pillow image library in cmd:
pip install pillow
copy and save the below text file to C:\scripts\compress_images.py,
and run this script in cmd with
py C:\scripts\compress_images.py
import os
import shutil
from PIL import Image
def has_transparency(img):
"""Return True if the image has an alpha channel or transparent palette."""
if img.mode == 'RGBA':
return True
if img.mode == 'P' and 'transparency' in img.info:
return True
if img.mode in ('LA', 'PA'):
return True
return False
def main():
print("""
================================================================
PNG Compressor & Image Copier
================================================================
This script will:
- Ask you for a folder path containing images
- Create an 'output' subfolder inside that folder
- Leave all your original images untouched
- For PNG files:
* If the PNG has transparency (alpha) -> copy original PNG to output
* Else convert PNG to JPG
* If the resulting JPG is LARGER than the original PNG,
delete the JPG and copy the original PNG instead
- For JPG, JPEG, GIF, WEBP files:
* Copy them unchanged to the output folder
* (If a JPG shares a name with a PNG, the JPG is skipped
because the PNG will produce a JPG or copy itself)
Purpose: Safely compress PNGs that are better as JPGs, while
preserving transparent images and never increasing file size.
================================================================
""")
# Ask for directory
while True:
root_dir = input("Paste (right-click) directory path containing images (or enter q to exit): ").strip()
if not root_dir:
print("No directory entered. Exiting.")Post too long. Click here to view the full text.