Skip to content

Instantly share code, notes, and snippets.

@pcast01
Last active October 30, 2019 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcast01/2b662e1cd16228b3e1ce207c5f490f50 to your computer and use it in GitHub Desktop.
Save pcast01/2b662e1cd16228b3e1ce207c5f490f50 to your computer and use it in GitHub Desktop.
$magick = 'C:\Program Files\ImageMagick-7.0.3-Q16\magick.exe'
# Create the folder to store Next Gen images
$currentPath = Get-Location
New-Item -ItemType Directory -Force -Path "$($currentPath)\Images\JP2Files\"
New-Item -ItemType Directory -Force -Path "$($currentPath)\Images\WebPFiles\"
New-Item -ItemType Directory -Force -Path "$($currentPath)\Images\JXRFiles\"
New-Item -ItemType Directory -Force -Path "$($currentPath)\Images\JPXFiles\"
#jp2
dir .\* -include ('*.png', '*.jpg') | select -ExpandProperty Name | ForEach-Object { & $magick convert ".\$($_)" "$($currentPath)\Images\JP2Files\$($_.ToString().Substring(0, $_.ToString().IndexOf('.'))).jp2" }
dir .\* -include ('*.png', '*.jpg') | select -ExpandProperty Name | ForEach-Object { & $magick convert ".\$($_)" "$($currentPath)\Images\WebPFiles\$($_.ToString().Substring(0, $_.ToString().IndexOf('.'))).webp" }
dir .\* -include ('*.png', '*.jpg') | select -ExpandProperty Name | ForEach-Object { & $magick convert ".\$($_)" "$($currentPath)\Images\JPXFiles\$($_.ToString().Substring(0, $_.ToString().IndexOf('.'))).jpx" }
dir .\* -include ('*.png', '*.jpg') | select -ExpandProperty Name | ForEach-Object { & $magick convert ".\$($_)" "$($currentPath)\Images\JXRFiles\$($_.ToString().Substring(0, $_.ToString().IndexOf('.'))).jxr" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment