Skip to content

Instantly share code, notes, and snippets.

@sator-imaging
Created April 10, 2020 13:08
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 sator-imaging/9f0aacc51d0817cf3879fb4221974feb to your computer and use it in GitHub Desktop.
Save sator-imaging/9f0aacc51d0817cf3879fb4221974feb to your computer and use it in GitHub Desktop.
Batch Script for OptiX Denoiser CLI by @DeclanRussell
@echo off
::::::: SETTING :::::::
set DENOISER_EXE=C:\Path\To\OptiX Denoiser Standalone\Denoiser_v2.4\Denoiser.exe
set SRC_BACKUP_FOLDER=BeforeDenoise~
set SRC_BACKUP_PREFIX=
::::::: INPUT :::::::
if NOT EXIST "%~1" (
echo.
echo No Directory Found. Drag ^& Drop Directory to Denoise.
echo.
timeout 10
goto :EOF
)
set /p DENOISER_ARGS=Additional denoiser options [-h or any]:
if "-h"=="%DENOISER_ARGS%" (
echo.
"%DENOISER_EXE%" -h
echo.
pause
goto :EOF
)
set /p TARGET_EXT=Enter target file extension [png or any]:
echo Target File Extension is set to: %TARGET_EXT%
echo.
::::::: MAIN :::::::
call :MAIN "%~dpn1"
echo.
pause
goto :EOF
:MAIN
pushd "%~dpn1"
if not 0==%ERRORLEVEL% (
echo.
echo Not a Directory: %~dpnx1
echo.
::timeout 10
goto :EOF
)
mkdir "%SRC_BACKUP_FOLDER%" 2>nul
for %%I in (*.%TARGET_EXT%) do (
echo.
echo Denoising...: %%~nxI
if NOT EXIST "%~dpn1\%SRC_BACKUP_FOLDER%\%SRC_BACKUP_PREFIX%%%~nI.%TARGET_EXT%" (
copy /-Y "%%~nI.%TARGET_EXT%" "%~dpn1\%SRC_BACKUP_FOLDER%\%SRC_BACKUP_PREFIX%%%~nI.%TARGET_EXT%"
) else (
echo Original File exists... copy skipped.
)
"%DENOISER_EXE%" %DENOISER_ARGS% -i "%~dpn1\%SRC_BACKUP_FOLDER%\%SRC_BACKUP_PREFIX%%%~nI.%TARGET_EXT%" -o "%%~nI.%TARGET_EXT%"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment