axembin

Axem's NVDXT Batch Script

Jun 27th, 2011
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. @ECHO OFF
  2. Echo ==============================================================================
  3. ECHO Welcome to Axem's NVDXT Batch Converter.
  4. Echo ==============================================================================
  5. :ConvertMode
  6.  
  7. :InputSet
  8. Echo ==============================================================================
  9. ECHO Enter Input Directory. Leave blank for the current directory. (No trailing \)
  10. SET /P inputDir=Input Directory:
  11. If not defined inputDir set inputDir=%cd%
  12. REM Echo %inputDir%
  13.  
  14. :OutputSet
  15. Echo ==============================================================================
  16. ECHO Enter Output Directory. Leave blank for the current directory. (No trailing \)
  17. SET /P outputDir=Output Directory:
  18. If not defined outputDir set outputDir=%cd%
  19. REM Echo %outputDir%
  20. Echo ==============================================================================
  21. Echo Please enter the input string. Wildcards accepted.
  22. Echo Examples:
  23. Echo exp04_0000.png - Exact file
  24. Echo exp*.* - Starts with exp
  25. Echo *_0000.* - Ends with _0000
  26. Echo *.png - All PNG files
  27.  
  28. :InputStringSet
  29. SET /P inputString=Input String:
  30. If not defined inputString goto InputStringSet
  31. REM Echo %inputString%
  32.  
  33. :DXTSet
  34. Echo ==============================================================================
  35. Echo Please select your DXT compression
  36. choice /C 135nu /N /M "Use DXT[1], DXT[3], DXT[5], DXT5[n]m, [U]888"
  37. IF ERRORLEVEL 5 ( SET DXT=-u888 && GOTO DXTdone )
  38. IF ERRORLEVEL 4 ( SET DXT=-dxt5nm && GOTO DXTdone )
  39. IF ERRORLEVEL 3 ( SET DXT=-dxt5 && GOTO DXTdone )
  40. IF ERRORLEVEL 2 ( SET DXT=-dxt3 && GOTO DXTdone )
  41. IF ERRORLEVEL 1 ( SET DXT=-dxt1a && GOTO DXTdone )
  42. :DXTdone
  43. REM Echo %DXT%
  44. echo If I need to rescale the image, should it to the...
  45. choice /C nhld /N /M "[N]earest power of 2, next [H]igher power of 2, the next [L]ower power of 2, or [D]on't touch it"
  46. IF ERRORLEVEL 4 ( SET rescale= && GOTO RescaleDone )
  47. IF ERRORLEVEL 3 ( SET rescale=-rescale next_lo && GOTO RescaleDone )
  48. IF ERRORLEVEL 2 ( SET rescale=-rescale hi && GOTO RescaleDone )
  49. IF ERRORLEVEL 1 ( SET rescale=-rescale nearest && GOTO RescaleDone )
  50. :RescaleDone
  51.  
  52. choice /C yn /M "Would you like MipMaps?"
  53. IF ERRORLEVEL 2 ( SET mipmap=-nomipmap && GOTO MipMapDone )
  54. IF ERRORLEVEL 1 ( SET mipmap= && GOTO MipMapDone )
  55. :MipMapDone
  56. Echo ==============================================================================
  57. Echo ==============================================================================
  58. Echo NVDXT will run with...
  59. Echo Input: %inputDir%\%inputString%
  60. Echo Output: %outputDir%
  61. Echo Compression: %DXT%
  62. Echo Rescale Style: %rescale%
  63. IF defined mipmap echo Mipmaps Off
  64. choice /C yn /M "Is this okay"
  65. IF ERRORLEVEL 2 GOTO ConvertMode
  66. IF ERRORLEVEL 1 GOTO RunNVDXT
  67. :RunNVDXT
  68. Echo ==============================================================================
  69. Echo ==============================================================================
  70. Echo Running NVDXT...
  71.  
  72. nvdxt -file %inputDir%\%inputString% -outdir %outputDir% -quality_highest %DXT% %rescale% %mipmap% -overwrite
  73.  
  74. :EndBatch
  75.  
  76. Echo Script has finished running.
  77. pause
Advertisement
Add Comment
Please, Sign In to add comment