Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. @echo off
  2. title waifu2x CLI
  3. echo waifu2x CLI
  4.  
  5.  
  6. :start
  7. echo Select processing units for waifu2x
  8. .\waifu2x-converter-cpp.exe -l
  9. set /p processor="Enter processor ID: "
  10. if '%processor%' == '' goto start
  11. echo.
  12. cls
  13. goto threadcount
  14.  
  15.  
  16. :threadcount
  17. echo Set thread count for processing "(>1)"
  18. set /p thread="Thread count: "
  19. if '%thread%' == '' goto threadcount
  20. echo.
  21. cls
  22. goto mode
  23.  
  24. :mode
  25. echo Select waifu2x mode
  26. echo 1 scale only
  27. echo 2 noise reduction only
  28. echo 3 scale+noise reduction
  29. set /p mode="Mode: "
  30. echo.
  31. if '%mode%'=='1' goto scale
  32. if '%mode%'=='2' goto noise
  33. if '%mode%'=='3' goto snr
  34.  
  35. :scale
  36. cls
  37. echo Scaler Only Mode
  38. echo.
  39. echo Set desired scale ratio (1~2)
  40. echo Scale value above 2 is NOT recommended
  41. set /p scaler="Scale ratio: "
  42. set modeset=-m scale --scale-ratio %scaler%
  43. echo.
  44. cls
  45. goto inputfile
  46.  
  47. :noise
  48. cls
  49. echo Noise Reduction Only Mode
  50. echo.
  51. echo Set desired noise level (0-3)
  52. set /p noisel="Noise level: "
  53. set modeset=-m noise --noise-level %noisel%
  54. echo.
  55. cls
  56. goto inputfile
  57.  
  58. :snr
  59. cls
  60. echo Scale and Noise Reduction Mode
  61. echo.
  62. echo Set desired scale ratio (1~2)
  63. echo Scale value above 2 is NOT recommended
  64. set /p scaler="Scale ratio: "
  65. echo.
  66. echo Set desired noise level (0-3)
  67. set /p noisel="Noise level: "
  68. set modeset=-m noise-scale --scale-ratio %scaler% --noise-level %noisel%
  69. echo.
  70. cls
  71. goto inputfile
  72.  
  73. :inputfile
  74. cls
  75. .\waifu2x-converter-cpp.exe --list-opencv-formats
  76. echo.
  77. echo Please input your image filepath
  78. echo Example: "C:\path\to\image\input\file.jpg"
  79. echo You can drop the file here
  80. set /p inputfile="Image input filepath: "
  81. if '%inputfile%' == '' goto inputfile
  82. echo.
  83. goto outputfile
  84.  
  85. :outputfile
  86. cls
  87. echo Please input your output image filepath
  88. echo Example: "C:\path\to\image\output\file.jpg"
  89. echo The extension should match the inputfile
  90. set /p outputfile="Image output filepath: "
  91. if '%outputfile%' == '' goto outputfile
  92. echo.
  93. goto inputformat
  94.  
  95. :inputformat
  96. cls
  97. echo Select your input format
  98. echo 1 JPEG/JPG/WebM
  99. echo 2 PNG
  100. echo 3 Anything else (or if you're not sure about the format)
  101. set /p inputformat="Input format: "
  102. cls
  103. if '%inputformat%'=='1' goto jpg
  104. if '%inputformat%'=='2' goto png
  105. if '%inputformat%'=='3' goto startstd
  106.  
  107. echo.
  108.  
  109.  
  110. :jpg
  111. echo Set JPEG/JPG/WebM compression quality (0-100), 100 = Max quality, larger file
  112. set /p jpgcomp="Input compression value: "
  113. if '%jpgcomp%' == '' set jpgcomp=100
  114. echo.
  115. set compcommand=-q %jpgcomp%
  116. goto confirmation
  117.  
  118. :png
  119. echo Set PNG compression value (0-9), 9 = Max compression (slow,smallest)
  120. set /p pngcomp="Input compression value: "
  121. if '%pngcomp%' == '' set pngcomp=0
  122. echo.
  123. set compcommand=-c %pngcomp%
  124. goto confirmation
  125.  
  126. :confirmation
  127. cls
  128. echo Please confirm your input!
  129. echo.
  130. echo Processor list:
  131. .\waifu2x-converter-cpp.exe -l
  132. echo Your choice is number %processor%
  133. echo.
  134. echo You want to use %thread% thread(s)
  135. echo.
  136. if '%mode%'=='1' echo You are using Scale Only Mode
  137. if '%mode%'=='2' echo You are using Noise Reduction Only Mode
  138. if '%mode%'=='3' echo You are using Scale and Noise Reduction Mode
  139. echo.
  140. echo Your JPEG/JPG/WebM compression quality is '%jpgcomp%' (ignore if you pick PNG/Anything else in the input format menu)
  141. echo.
  142. echo Your JPEG/JPG/WebM compression quality is '%pngcomp%' (ignore if you pick JPEG/Anything else in the input format menu)
  143. echo.
  144. pause
  145.  
  146. :process
  147. cls
  148. .\waifu2x-converter-cpp.exe -p %processor% -j %thread% %compcommand% %modeset% -i %inputfile% -o %outputfile%
  149. goto complete
  150.  
  151. :complete
  152. echo.
  153. echo Process complete!
  154. echo.
  155. echo Do you want to open the output file?
  156. choice
  157. if '%ERRORLEVEL%' == '1' %outputfile%
  158. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement