Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Last active November 25, 2026 01:22
Show Gist options
  • Select an option

  • Save easierbycode/9aabfd0c95a62b87380dc67ce632c902 to your computer and use it in GitHub Desktop.

Select an option

Save easierbycode/9aabfd0c95a62b87380dc67ce632c902 to your computer and use it in GitHub Desktop.
Get-ChildItem -Recurse -Filter *.heic | % {
$out = Join-Path $_.DirectoryName ($_.BaseName + '.jpg')
$h = if ($_.Length -ge 12) { [byte[]](Get-Content $_.FullName -Encoding Byte -TotalCount 12) }
if (-not $h) {
'{0}: EMPTY ({1} bytes)' -f $_.FullName, $_.Length
} elseif ($h[0] -eq 0xFF -and $h[1] -eq 0xD8) {
Copy-Item $_.FullName $out
} elseif ([Text.Encoding]::ASCII.GetString($h,4,4) -eq 'ftyp') {
magick $_.FullName -quality 90 $out
} else {
'{0} ({1} bytes): {2}' -f $_.FullName, $_.Length, (($h | % { '{0:X2}' -f $_ }) -join ' ')
}
}
winget install Gyan.FFmpeg
ffmpeg -i IMG_2985.mov -frames:v 1 IMG_2985.jpg
cd C:\Users\Owner\Pictures
ffprobe IMG_3149.mov
Get-ChildItem -Recurse -Filter *.heic | ? { [Text.Encoding]::ASCII.GetString([byte[]](Get-Content $_.FullName -Encoding Byte -TotalCount 12),4,6) -eq 'ftypqt' } | Rename-Item -NewName { $_.BaseName + '.mov' }
Get-ChildItem *.heic | % { '{0} ({1:N0} bytes): {2}' -f $_.Name, $_.Length, [Text.Encoding]::ASCII.GetString([byte[]](Get-Content $_.FullName -Encoding Byte -TotalCount 12),4,8) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment