-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOptimize-Textures.ps1
38 lines (31 loc) · 1.08 KB
/
Optimize-Textures.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[CmdletBinding()]
param (
[Parameter()]
[string]
$DirectoryToCompress,
[Parameter()]
[string]
$CompressionFormat
)
Get-ChildItem $DirectoryToCompress -Filter *.png |
ForEach-Object {
$OriginalFilename = $_.FullName
$KtxFilename = $OriginalFilename.Replace("png", "ktx2")
Write-Host "Converting file $OriginalFilename to $KtxFilename"
if($CompressionFormat -eq '') {
toktx --genmipmap --t2 --target_type RGBA $KtxFilename $OriginalFilename
} else {
toktx --genmipmap --t2 --target_type RGBA --encode $CompressionFormat $KtxFilename $OriginalFilename
}
}
Get-ChildItem $DirectoryToCompress -Filter *.jpg |
ForEach-Object {
$OriginalFilename = $_.FullName
$KtxFilename = $OriginalFilename.Replace("jpg", "ktx2")
Write-Host "Converting file $OriginalFilename to $KtxFilename"
if($CompressionFormat -eq '') {
toktx --genmipmap --t2 --target_type RGBA $KtxFilename $OriginalFilename
} else {
toktx --genmipmap --t2 --target_type RGBA --encode $CompressionFormat $KtxFilename $OriginalFilename
}
}