diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-11 16:39:18 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-11 16:39:18 +0800 |
| commit | 1cac5fd2abb77aeae894447ac890cff9cb56aa4e (patch) | |
| tree | 3e93294acbec4614728c9717e7dfb9e668ef05ce | |
| parent | e540a7db093c2e87c3b3ad2a13723e779c918ca9 (diff) | |
Add scripts: Convert-EXR-Assets.ps1
| -rw-r--r-- | Scripts/Convert-EXR-Assets.ps1 | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Scripts/Convert-EXR-Assets.ps1 b/Scripts/Convert-EXR-Assets.ps1 new file mode 100644 index 0000000..e0faed6 --- /dev/null +++ b/Scripts/Convert-EXR-Assets.ps1 @@ -0,0 +1,42 @@ +Add-Type -AssemblyName System.Windows.Forms + +# Modern folder picker (better looking dialog) +$dialog = New-Object System.Windows.Forms.OpenFileDialog +$dialog.Title = "Select a folder" +$dialog.CheckFileExists = $false +$dialog.CheckPathExists = $true +$dialog.Filter = "Folders|*.thisfolderisnotreal" +$dialog.FileName = "SELECT FOLDER" + +if ($dialog.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK) { + Write-Host "No folder selected, exiting..." + pause + exit +} + +$targetDir = Split-Path -Path $dialog.FileName -Parent +Write-Host "`nSelected Directory: $targetDir`n" + +# Get all EXR files +$exrFiles = Get-ChildItem -Path $targetDir -Filter *.exr -File + +if ($exrFiles.Count -eq 0) { + Write-Host "No EXR files found in this directory!" + pause + exit +} + +Write-Host "Found $($exrFiles.Count) EXR files, starting conversion..." + +# Convert +foreach ($file in $exrFiles) { + $inputPath = $file.FullName + $outputPath = Join-Path $targetDir ($file.BaseName + ".png") + + & ffmpeg -i $inputPath -vf "scale=1024:-1:flags=lanczos" -pix_fmt rgb24 -compression_level 6 -y $outputPath + + Write-Host "Converted: $($file.Name)" +} + +Write-Host "`nAll done!" +pause |
