Forum Discussion
How can I reduce JPEG file size in KB on Windows 11 without losing quality?
How to reduce jpeg file size in Windows 11? The trick is to use a PowerShell script that taps into .NET's image processing capabilities. The script looks at every JPG in your folder, calculates a new size based on your settings, and saves a compressed version. You can adjust the quality setting (like 80 or 70) to shrink the file size while keeping the image clear enough to view.
This script runs entirely from the command line. Just make sure to adjust the file paths for your specific folder locations.
How to set it up:
1. Press Windows + X and select Windows PowerShell (Admin)
2. You may need to allow script execution first. Run this command:
powershell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
3. Copy and paste the script below into the PowerShell window, modify the folder paths, and press Enter
Here's the script:
powershell
# ===== CONFIGURE THESE SETTINGS =====
$sourceFolder = "C:\Users\YourName\Pictures\Original" # <-- CHANGE THIS
$destFolder = "C:\Users\YourName\Pictures\Compressed" # <-- CHANGE THIS
$quality = 80 # Lower = smaller file size (60-85 works well for photos)
$maxWidth = 1920 # Optional: resize to this width (set to 0 to skip)
# ====================================