Created
July 20, 2025 20:27
-
-
Save Kianda/8352b4a3efe6012b3c68250acb7a29ff to your computer and use it in GitHub Desktop.
Fix corrupted motion photos (remove the video)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Drawing | |
$inputFile = "C:\Users\myuser\Desktop\test\IMG_20220910_100157.jpg" | |
$outputFile = "C:\Users\myuser\Desktop\test\output.jpg" | |
try { | |
# Load the image - this automatically ignores motion data | |
$img = [System.Drawing.Image]::FromFile((Resolve-Path $inputFile)) | |
# Save as new JPEG | |
$img.Save($outputFile, [System.Drawing.Imaging.ImageFormat]::Jpeg) | |
$img.Dispose() | |
Write-Host "Static photo saved successfully" | |
} | |
catch { | |
Write-Host "Error: $($_.Exception.Message)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment