If you have ever moved photos from an iPhone or iPad to a Windows PC, you have probably seen those .HEIC files. They are smaller and more efficient than JPEGs but unfortunately, they are not supported by many tools, websites, or editors.
For me, this used to be a huge time waster. I had to:
- Download photos from multiple network folders
- Use an online converter to change .heic files to .jpg
- Then use another app to resize them one by one to save space
It was slow, repetitive, and frustrating.
That’s when I decided to automate the entire process using PowerShell since Python is prohibited in my workplace for security and business reasons. We only use approved tools, and PowerShell is one of them.
So here’s how I solved it.
What This Script Does
This PowerShell script:
- Asks for the path of the folder containing your .HEIC images.
- Automatically scans all subfolders for .heic files.
- Converts each image to .jpg.
- Resizes the new image to 1920×1080 while keeping it centered and proportional.
- Deletes the original HEIC file after conversion.
Everything happens automatically you just run it once, and it takes care of hundreds (or thousands) of photos.
Steps Before Running the Script
Before you can use the script, you’ll need to set up a few things. Don’t worry it’s easy.
1. Install ImageMagick
ImageMagick is a free and trusted tool for image conversion.
You can download it from:
https://imagemagick.org
During installation, make sure to check this box:
“Add application directory to your system path”
That ensures you can run the magick command from anywhere in PowerShell.
2. Enable PowerShell Scripts (if needed)
If your system blocks PowerShell scripts, you might need to adjust the execution policy:
Set-ExecutionPolicy RemoteSigned
You may need administrator privileges for this step. Once set, you won’t have to do it again.
3. Prepare Your Folder
Put all your .HEIC files (and subfolders containing them) into one main folder.
The script will handle everything inside it automatically.
The PowerShell Script
# Ask for folder path
$folderPath = Read-Host "Enter the full path to the folder containing HEIC images"
# Set desired dimensions
$width = 1920
$height = 1080
# Get all .heic files inside the folder and subfolders
$files = Get-ChildItem -Path $folderPath -Recurse -Filter *.heic
# Check if any HEIC files were found
if ($files.Count -eq 0) {
Write-Host "`n No HEIC images found in: $folderPath"
exit
}
# Count total files
$total = $files.Count
$current = 1
# Loop through each HEIC file
foreach ($file in $files) {
Write-Host "[$current/$total] Converting: $($file.FullName)"
# Create the new .jpg file path
$jpegPath = [System.IO.Path]::ChangeExtension($file.FullName, ".jpg")
# Use ImageMagick to convert and resize
magick "$($file.FullName)" -resize "${width}x${height}^" -gravity center -extent "${width}x${height}" "$jpegPath"
# Delete the original HEIC file
Remove-Item $file.FullName
$current++
}
Write-Host "`n Done! All HEIC images converted and resized to 1920x1080 in: $folderPath"
Note: This script already converts files inside all subfolders because of the -Recurse flag in Get-ChildItem. You don’t need to modify anything for that to work.
How It Works (Step-by-Step)
Here’s what happens when you run it:
- You enter the folder path when prompted.
- The script finds every .heic file (even in subfolders).
- For each one:
- It creates a .jpg version using ImageMagick.
- Resizes it to 1920×1080, centered and cropped properly.
- Deletes the original .heic file to save space.
- At the end, you’ll have all your photos neatly converted and resized ready to use anywhere.
Why I Used PowerShell Instead of Python
In many workplaces, including mine, Python is not allowed due to:
- Security restrictions Python scripts can access and modify system files easily.
- Business policies It’s not part of our approved tech stack, and we don’t need it for normal business operations.
PowerShell, on the other hand, is secure, approved, and already built into Windows. It is perfect for small automation tasks like this one and no external dependencies beyond ImageMagick are required.
The Result
With this setup, I was able to convert and resize hundreds of HEIC photos stored across multiple folders automatically.
No manual downloading. No online converters. No third-party resizing tools.
Just one PowerShell script, a few seconds of setup, and done .
Final Thoughts
This little project saved me a ton of time and hassle. It is a great example of how you can use built-in tools like PowerShell to simplify your workflow even in environments with strict software policies.
If you are dealing with HEIC files and need a quick, safe, and repeatable way to convert them to JPEG, this method works perfectly.
