├── waifu2x_i18n_gui
├── MagGlass.ico
├── App.xaml
├── waifu2x_i18n_gui.csproj.DotSettings
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Settings.settings
│ ├── Resources.resx
│ └── Settings.Designer.cs
├── de-DE
│ └── UILang.de-DE.xaml
├── App.xaml.cs
├── App.config
├── zh-TW
│ └── UIlang.zh-TW.xaml
├── zh-CN
│ └── UIlang.zh-CN.xaml
├── ja-JP
│ └── UIlang.ja-JP.xaml
├── ko-KR
│ └── UIlang.ko-KR.xaml
├── en-US
│ └── UILang.en-US.xaml
├── pt-BR
│ └── UILang.pt-BR.xaml
├── es-AR
│ └── UILang.es-AR.xaml
├── fr-FR
│ └── UILang.fr-FR.xaml
├── it-IT
│ └── UILang.it-IT.xaml
├── waifu2x_ncnn_vulkan_gui.csproj
├── MainWindow.xaml
└── MainWindow.xaml.cs
├── LICENSE
├── waifu2x_ncnn_vulkan_gui.sln
├── README.md
└── .gitignore
/waifu2x_i18n_gui/MagGlass.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flavw/waifu2x-GUI/HEAD/waifu2x_i18n_gui/MagGlass.ico
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/waifu2x_i18n_gui.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 | True
5 | True
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 f11894
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/waifu2x_ncnn_vulkan_gui.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2010
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "waifu2x_ncnn_vulkan_gui", "waifu2x_i18n_gui\waifu2x_ncnn_vulkan_gui.csproj", "{4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Release|Any CPU = Release|Any CPU
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Debug|x64.ActiveCfg = Debug|x64
21 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Debug|x64.Build.0 = Debug|x64
22 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Debug|x86.ActiveCfg = Debug|x86
23 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Debug|x86.Build.0 = Debug|x86
24 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Release|x64.ActiveCfg = Release|x64
27 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Release|x64.Build.0 = Release|x64
28 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Release|x86.ActiveCfg = Release|x86
29 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}.Release|x86.Build.0 = Release|x86
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {6EBD714C-AF2D-44A4-B1C7-D015ACFADE97}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # waifu2x-GUI
2 | 
3 | Windows Multilingual GUI for [waifu2x-ncnn-vulkan](https://github.com/nihui/waifu2x-ncnn-vulkan), [realesrgan-ncnn-vulkan](https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan), [realcugan-ncnn-vulkan](https://github.com/nihui/realcugan-ncnn-vulkan) and [realsr-ncnn-vulkan](https://github.com/nihui/realsr-ncnn-vulkan).
4 |
5 | Waifu2x is an image scaling and noise reduction program designed primarily for anime-style art, but it can also be used for other types of photos. It was inspired by the Super-Resolution Convolutional Neural Network (SRCNN) and uses deep learning techniques to upscale images while reducing noise.
6 |
7 | This project was forked from [waifu2x-ncnn-vulkan-GUI](https://github.com/RxinnotRstar/waifu2x-ncnn-vulkan-GUI). The original developer is [f11894](https://github.com/f11894).
8 |
9 | ## Download
10 | Download [here](https://github.com/flavw/waifu2x-ncnn-vulkan-GUI/releases/download/2.1.1.3/waifu2x-ncnn-vulkan-GUI_2.1.1.3.zip)
11 |
12 | ## Localization
13 | 1. Localization can be done via user-editable xaml file.
14 | 2. The localization files have the name UILang._language-code_.xaml; where _language-code_ is a 5-character identifier like en-US, zh-TW, ja-JP.
15 | 3. Make a copy of one of the bundled localization files.
16 | 4. Rename the file with your target language code replacing the original.
17 | 5. Using a text editor that support UTF-8, make the following changes:
18 | * ```waifu2xui-en-US```
19 | * Replace en-US with the target language code
20 | * All the text enclosed by the `````` tags
21 | 6. About language code:
22 | * Make up from _ab_-_XY_
23 | * ab can be found [Here](http://www.loc.gov/standards/iso639-2/php/langcodes-search.php) as Alpha-2 codes
24 | * XY can be found [Here](https://www.iso.org/obp/ui/#search)
25 | * Essentially _ab_ is the language, _XY_ is the country
26 | * Translators: @flavw, @laikal, @martin-varela, @MartBlur, @papjul, @xperiazu21, @yoaan, @Magneticdud.
27 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("waifu2x_ncnn_vulkan_gui")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("waifu2x_ncnn_vulkan_gui")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | //In order to begin building localizable applications, set
23 | //CultureYouAreCodingWith in your .csproj file
24 | //inside a . For example, if you are using US english
25 | //in your source files, set the to en-US. Then uncomment
26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
27 | //the line below to match the UICulture setting in the project file.
28 |
29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
30 |
31 |
32 | [assembly: ThemeInfo(
33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
34 | //(used if a resource is not found in the page,
35 | // or application resource dictionaries)
36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
37 | //(used if a resource is not found in the page,
38 | // app, or any theme specific resource dictionaries)
39 | )]
40 |
41 |
42 | // Version information for an assembly consists of the following four values:
43 | //
44 | // Major Version
45 | // Minor Version
46 | // Build Number
47 | // Revision
48 | //
49 | // You can specify all the values or you can default the Build and Revision Numbers
50 | // by using the '*' as shown below:
51 | // [assembly: AssemblyVersion("1.0.*")]
52 | [assembly: AssemblyVersion("1.0.0.0")]
53 | [assembly: AssemblyFileVersion("1.0.0.0")]
54 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/de-DE/UILang.de-DE.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-de-DE
5 |
6 | 'waifu2x-caffe' mehrsprachiges grafisches Interface
7 | Hilfe
8 | Hilfe
9 | Über
10 |
11 | Ein-, und Ausgabe
12 | Modus
13 | Gerät
14 |
15 | Quelle:
16 | Ausgabe:
17 | Dateitypen (eingabe)
18 | Dateitypen (ausgabe)
19 | Quelldatei wählen
20 | Zieldatei bestimmen
21 | Zurücksetzen
22 | Dateinamen-, oder Ordnerpfad. Pflichtfeld!
23 | Dateinamen-, oder Ordnerpfad. Wenn leer, wird die neue Datei im Quallordner erstellt!
24 |
25 | Vergrößerung (1.0~8.0):
26 | Rauschentfernung
27 | Keine
28 | Schwach
29 | Stark
30 | Farbmodus
31 | RGB
32 | nur-Y
33 | Bild
34 |
35 | Rechengerät
36 | CPU
37 | CUDA
38 | cuDNN
39 | Block Größe
40 |
41 | Start!
42 |
43 | ABBRUCH
44 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading;
6 | using System.Windows;
7 |
8 | namespace waifu2x_ncnn_vulkan_gui
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | ///
14 |
15 | public partial class App : Application
16 | {
17 | public static String directory;
18 | public static App Instance;
19 | public event EventHandler LangChangedEvent;
20 |
21 | #region Constructor
22 | public App()
23 | {
24 | Instance = this;
25 | directory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
26 | SetLangResDictionary(GetLangFilePath(CultureInfo.CurrentCulture.Name));
27 |
28 | }
29 | #endregion
30 |
31 | public void SwitchLanguage(string langcode)
32 | {
33 | if (CultureInfo.CurrentCulture.Name.Equals(langcode))
34 | {
35 | return;
36 | }
37 | var ci = new CultureInfo(langcode);
38 | Thread.CurrentThread.CurrentCulture = ci;
39 | Thread.CurrentThread.CurrentUICulture = ci;
40 | SetLangResDictionary(GetLangFilePath(langcode));
41 | if (LangChangedEvent != null)
42 | {
43 | LangChangedEvent(this, new EventArgs());
44 | }
45 | }
46 |
47 | private string GetLangFilePath(string langCode)
48 | {
49 | string xmlname = "UILang." + langCode + ".xaml";
50 | var lang_fn = Path.Combine(directory, xmlname);
51 | if (!File.Exists(lang_fn))
52 | {
53 | xmlname = "UILang.en-US.xaml";
54 | lang_fn = Path.Combine(directory, xmlname);
55 | }
56 | return lang_fn;
57 | }
58 |
59 | private void SetLangResDictionary(string inFile)
60 | {
61 | if (File.Exists(inFile))
62 | {
63 | var langDict = new ResourceDictionary();
64 | langDict.Source = new Uri(inFile);
65 | int langDictId = -1;
66 | for (int i = 0; i < Resources.MergedDictionaries.Count(); i++)
67 | {
68 | var md = Resources.MergedDictionaries[i];
69 | if (md.Contains("ResourceDictionaryName"))
70 | {
71 | if (md["ResourceDictionaryName"].ToString().StartsWith("waifu2xui-"))
72 | {
73 | langDictId = i;
74 | break;
75 | }
76 | }
77 | }
78 | if (langDictId <= -1)
79 | {
80 | Resources.MergedDictionaries.Add(langDict);
81 | }
82 | else
83 | {
84 | Resources.MergedDictionaries[langDictId] = langDict;
85 | }
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // O código foi gerado por uma ferramenta.
4 | // Versão de Tempo de Execução:4.0.30319.42000
5 | //
6 | // As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se
7 | // o código for gerado novamente.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace waifu2x_ncnn_vulkan_gui.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc.
17 | ///
18 | // Essa classe foi gerada automaticamente pela classe StronglyTypedResourceBuilder
19 | // através de uma ferramenta como ResGen ou Visual Studio.
20 | // Para adicionar ou remover um associado, edite o arquivo .ResX e execute ResGen novamente
21 | // com a opção /str, ou recrie o projeto do VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Retorna a instância de ResourceManager armazenada em cache usada por essa classe.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("waifu2x_ncnn_vulkan_gui.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Substitui a propriedade CurrentUICulture do thread atual para todas as
51 | /// pesquisas de recursos que usam essa classe de recurso de tipo de alta segurança.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 2
7 |
8 |
9 | 0
10 |
11 |
12 | 100
13 |
14 |
15 | scale
16 |
17 |
18 | True
19 |
20 |
21 | null
22 |
23 |
24 | False
25 |
26 |
27 | False
28 |
29 |
30 | models-cunet
31 |
32 |
33 | 0
34 |
35 |
36 | 2
37 |
38 |
39 | False
40 |
41 |
42 | False
43 |
44 |
45 | True
46 |
47 |
48 | 0
49 |
50 |
51 | 100
52 |
53 |
54 | False
55 |
56 |
57 | 0
58 |
59 |
60 | 0
61 |
62 |
63 | 0
64 |
65 |
66 | Scale_ratio_mode
67 |
68 |
69 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studo 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | *_i.c
42 | *_p.c
43 | *_i.h
44 | *.ilk
45 | *.meta
46 | *.obj
47 | *.pch
48 | *.pdb
49 | *.pgc
50 | *.pgd
51 | *.rsp
52 | *.sbr
53 | *.tlb
54 | *.tli
55 | *.tlh
56 | *.tmp
57 | *.tmp_proj
58 | *.log
59 | *.vspscc
60 | *.vssscc
61 | .builds
62 | *.pidb
63 | *.svclog
64 | *.scc
65 |
66 | # Chutzpah Test files
67 | _Chutzpah*
68 |
69 | # Visual C++ cache files
70 | ipch/
71 | *.aps
72 | *.ncb
73 | *.opensdf
74 | *.sdf
75 | *.cachefile
76 |
77 | # Visual Studio profiler
78 | *.psess
79 | *.vsp
80 | *.vspx
81 |
82 | # TFS 2012 Local Workspace
83 | $tf/
84 |
85 | # Guidance Automation Toolkit
86 | *.gpState
87 |
88 | # ReSharper is a .NET coding add-in
89 | _ReSharper*/
90 | *.[Rr]e[Ss]harper
91 | *.DotSettings.user
92 |
93 | # JustCode is a .NET coding addin-in
94 | .JustCode
95 |
96 | # TeamCity is a build add-in
97 | _TeamCity*
98 |
99 | # DotCover is a Code Coverage Tool
100 | *.dotCover
101 |
102 | # NCrunch
103 | _NCrunch_*
104 | .*crunch*.local.xml
105 |
106 | # MightyMoose
107 | *.mm.*
108 | AutoTest.Net/
109 |
110 | # Web workbench (sass)
111 | .sass-cache/
112 |
113 | # Installshield output folder
114 | [Ee]xpress/
115 |
116 | # DocProject is a documentation generator add-in
117 | DocProject/buildhelp/
118 | DocProject/Help/*.HxT
119 | DocProject/Help/*.HxC
120 | DocProject/Help/*.hhc
121 | DocProject/Help/*.hhk
122 | DocProject/Help/*.hhp
123 | DocProject/Help/Html2
124 | DocProject/Help/html
125 |
126 | # Click-Once directory
127 | publish/
128 |
129 | # Publish Web Output
130 | *.[Pp]ublish.xml
131 | *.azurePubxml
132 | # TODO: Comment the next line if you want to checkin your web deploy settings
133 | # but database connection strings (with potential passwords) will be unencrypted
134 | *.pubxml
135 | *.publishproj
136 |
137 | # NuGet Packages
138 | *.nupkg
139 | # The packages folder can be ignored because of Package Restore
140 | **/packages/*
141 | # except build/, which is used as an MSBuild target.
142 | !**/packages/build/
143 | # Uncomment if necessary however generally it will be regenerated when needed
144 | #!**/packages/repositories.config
145 |
146 | # Windows Azure Build Output
147 | csx/
148 | *.build.csdef
149 |
150 | # Windows Store app package directory
151 | AppPackages/
152 |
153 | # Others
154 | *.[Cc]ache
155 | ClientBin/
156 | [Ss]tyle[Cc]op.*
157 | ~$*
158 | *~
159 | *.dbmdl
160 | *.dbproj.schemaview
161 | *.pfx
162 | *.publishsettings
163 | node_modules/
164 | bower_components/
165 |
166 | # RIA/Silverlight projects
167 | Generated_Code/
168 |
169 | # Backup & report files from converting an old project file
170 | # to a newer Visual Studio version. Backup files are not needed,
171 | # because we have git ;-)
172 | _UpgradeReport_Files/
173 | Backup*/
174 | UpgradeLog*.XML
175 | UpgradeLog*.htm
176 |
177 | # SQL Server files
178 | *.mdf
179 | *.ldf
180 |
181 | # Business Intelligence projects
182 | *.rdl.data
183 | *.bim.layout
184 | *.bim_*.settings
185 |
186 | # Microsoft Fakes
187 | FakesAssemblies/
188 |
189 | # Node.js Tools for Visual Studio
190 | .ntvs_analysis.dat
191 |
192 | # Visual Studio 6 build log
193 | *.plg
194 |
195 | # Visual Studio 6 workspace options file
196 | *.opt
197 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 2
16 |
17 |
18 | 0
19 |
20 |
21 | 100
22 |
23 |
24 | scale
25 |
26 |
27 | True
28 |
29 |
30 | null
31 |
32 |
33 | False
34 |
35 |
36 | False
37 |
38 |
39 | models-cunet
40 |
41 |
42 | 0
43 |
44 |
45 | 2
46 |
47 |
48 | False
49 |
50 |
51 | False
52 |
53 |
54 | True
55 |
56 |
57 | 0
58 |
59 |
60 | 100
61 |
62 |
63 | False
64 |
65 |
66 | 0
67 |
68 |
69 | 0
70 |
71 |
72 | 0
73 |
74 |
75 | Scale_ratio_mode
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/zh-TW/UIlang.zh-TW.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-zh-TW
5 |
6 | waifu2x-ncnn-vulkan multilingual GUI
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 | 放大 & 降噪(僅jpg)
35 | 低
36 | 中
37 | 高
38 | 最高
39 | 風格
40 | 2D插圖 (waifu2x CUnet模型)
41 | 2D插圖 (waifu2x UpRGB模型)
42 | 照片 (waifu2x UpPhoto模型)
43 | 2D插圖 (Real-CUGAN se模型)
44 | 2D插圖 (Real-CUGAN pro模型)
45 | 照片 (Real-ESRGANrealesrgan-x4plus模型)
46 | 照片 (Real-ESRGAN realesrnet-x4plus模型)
47 | 2D插圖 (Real-ESRGAN realesrgan-x4plus-anime模型)
48 | 2D插圖 (Real-ESRGAN realesr-animevideov3模型)
49 | 照片 (RealSR DF2K模型)
50 | 照片 (RealSR DF2K_JPEG模型)
51 | 塊大小
52 | 裝置
53 | GPU ID
54 |
55 | 偏好設定
56 |
57 | 保存最後輸出路徑
58 | 不覆蓋輸出文件
59 | 處理後播放提示音
60 | 執行高精度處理(fp32模式)
61 | 使用ImageMagick分離Alpha通道
62 | 保持縱橫比
63 |
64 | 執行!
65 |
66 | 中止
67 |
68 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/zh-CN/UIlang.zh-CN.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-zh-CN
5 |
6 | waifu2x-ncnn-vulkan multilingual图形界面
7 | 关于
8 | 帮助
9 | 版本信息
10 |
11 | 输入输出设置
12 |
13 | 输入路径:
14 | 输出路径:
15 | 选择输入路径
16 | 清除
17 | 选择输出路径
18 | 清除
19 | 输入文件名或文件夹(必须)
20 | 输出文件名或文件夹,若留空将在输入路径下自动生成对应文件
21 | 输出文件格式
22 | 输出图像质量
23 |
24 | 转换模式
25 | 降噪 & 放大
26 | 只放大
27 | 只降噪
28 | 放大 & 降噪(仅jpg)
29 | 放大尺寸
30 | 放大倍率
31 | 放大后宽度
32 | 放大后高度
33 | 放大后宽高
34 | 降噪程度
35 | 低
36 | 中
37 | 高
38 | 最高
39 | 风格
40 | 2D插图 (waifu2x CUnet模型)
41 | 2D插图 (waifu2x UpRGB模型)
42 | 照片 (waifu2x UpPhoto模型)
43 | 2D插图 (Real-CUGAN se模型)
44 | 2D插图 (Real-CUGAN pro模型)
45 | 照片 (Real-ESRGAN realesrgan-x4plus模型)
46 | 照片 (Real-ESRGAN realesrnet-x4plus模型)
47 | 2D插图 (Real-ESRGAN realesrgan-x4plus-anime模型)
48 | 2D插图 (Real-ESRGAN realesr-animevideov3模型)
49 | 照片 (RealSR DF2K模型)
50 | 照片 (RealSR DF2K_JPEG模型)
51 | 每块大小
52 | 设备
53 | GPU ID
54 |
55 | 偏好
56 |
57 | 存储最后的输出路径
58 | 输出文件不覆盖
59 | 处理后播放提示音
60 | 执行高精度处理(fp32模式)
61 | 使用ImageMagick分离Alpha通道
62 | 保持宽高比
63 |
64 | 执行!
65 |
66 | 终止
67 |
68 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/ja-JP/UIlang.ja-JP.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-ja-JP
5 |
6 | waifu2x-ncnn-vulkan 多国言語 インタフェース
7 | ソフトについて
8 | 説明
9 | Version Info
10 |
11 | 設定
12 |
13 | 入力先:
14 | 出力先:
15 | 入力先選択
16 | クリア
17 | 出力先選択
18 | クリア
19 | 画像名もしくはフォルダ名(必要)
20 | 画像の出力先。空白の場合、入力画像と同じフォルダに新しい画像を生成する
21 | 出力拡張子
22 | 出力画質設定
23 |
24 | 変換モード
25 | ノイズ除去と拡大
26 | 拡大
27 | ノイズ除去
28 | ノイズ除去(jpgのみ)と拡大
29 | 拡大サイズ
30 | 拡大率を指定
31 | 横幅を指定
32 | 縦幅を指定
33 | 横幅と縦幅を指定
34 | ノイズ除去
35 | レベル0
36 | レベル1
37 | レベル2
38 | レベル3
39 | モデル
40 | 二次元イラスト (waifu2x CUnetモデル)
41 | 二次元イラスト (waifu2x UpRGBモデル)
42 | 写真・アニメ (waifu2x UpPhotoモデル)
43 | アニメ (Real-CUGAN seモデル)
44 | アニメ (Real-CUGAN proモデル)
45 | 写真 (Real-ESRGAN realesrgan-x4plusモデル)
46 | 写真 (Real-ESRGAN realesrnet-x4plusモデル)
47 | 二次元イラスト・アニメ (Real-ESRGAN realesrgan-x4plus-animeモデル)
48 | アニメ (Real-ESRGAN realesr-animevideov3モデル)
49 | 写真 (RealSR DF2Kモデル)
50 | 写真 (RealSR DF2K_JPEGモデル)
51 | 分割サイズ
52 | デバイス
53 | GPU ID
54 |
55 | 動作設定
56 |
57 | 前回出力したパスを記憶する
58 | 出力ファイルを上書きしない
59 | 処理が終わったら音を鳴らす
60 | 高精度処理を行う(fp32モード)
61 | アルファチャンネルをImageMagickで分離して処理する
62 | 縦横比を維持する
63 |
64 | 実行
65 |
66 | キャンセル
67 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/ko-KR/UIlang.ko-KR.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-ko-KR
5 |
6 | waifu2x-ncnn-vulkan 다국어 인터페이스
7 | 프로그램에 대해서
8 | 설명
9 | Version Info
10 |
11 | 설정
12 |
13 | 열린 파일:
14 | 출력 위치:
15 | 열기
16 | 삭제
17 | 출력 위치 선택
18 | 삭제
19 | 이미지 이름 또는 폴더 이름
20 | 이미지가 출력될 폴더 공백의 경우 입력 이미지와 같은 곳에 이미지를 생성합니다.
21 | 파일 확장자
22 | 화질 설정
23 |
24 | 변환 모드
25 | 노이즈 제거와 확대
26 | 확대
27 | 노이즈 제거
28 | 노이즈 제거 및 확대(JPG한정)
29 | 확대 설정
30 | 확대율로 설정
31 | 변환 후의 가로 길이
32 | 변환 후의 세로 길이
33 | 가로x세로로 확대
34 | 노이즈 제거
35 | 레벨0
36 | 레벨1
37 | 레벨2
38 | 레벨3
39 | 방식
40 | 2D 일러스트 (waifu2x CUnet방식))
41 | 2D 일러스트 (waifu2x UpRGB방식)
42 | Photo (UpPhoto방식)
43 | 2D 일러스트 (Real-CUGAN se방식)
44 | 2D 일러스트 (Real-CUGAN pro방식)
45 | Photo (Real-ESRGAN realesrgan-x4plus방식)
46 | Photo (Real-ESRGAN realesrnet-x4plus방식)
47 | 2D 일러스트 (Real-ESRGAN realesrgan-x4plus-anime방식)
48 | 2D 일러스트 (Real-ESRGAN realesr-animevideov3방식)
49 | Photo (RealSR DF2K방식)
50 | Photo (RealSR DF2K_JPEG방식)
51 | 조각 크기
52 | 장치
53 | GPU ID
54 |
55 | 동작 설정
56 |
57 | 이전에 출력한 경로를 기억합니다.
58 | 출력 파일을 덮어쓰지 않습니다.
59 | 처리가 끝나면 소리로 알립니다.
60 | 고정밀도 처리(fp32 모드)
61 | 알파 채널을 Image Magick으로 분리하여 처리합니다.
62 | 종횡비 유지
63 |
64 | 실행
65 |
66 | 취소
67 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/en-US/UILang.en-US.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-en-US
5 |
6 | waifu2x-ncnn-vulkan multilingual GUI
7 | About
8 | Help
9 | Version Info
10 |
11 | Settings
12 |
13 | Source:
14 | Destination:
15 | Source
16 | Clear
17 | Destination
18 | Clear
19 | Filename or folder path. REQUIRED field
20 | Output destination path. If empty, generate a new file in the source folder
21 | Output extension
22 | Output quality
23 |
24 | Conversion Mode
25 | Denoise & Magnify
26 | Magnify only
27 | Denoise only
28 | Magnify & Denoise (jpg only)
29 | Magnification Size
30 | Set rate
31 | Set width (pixels)
32 | Set height (pixels)
33 | Set resolution (pixels)
34 | Denoise
35 | Level 0
36 | Level 1
37 | Level 2
38 | Level 3
39 | Model
40 | 2D illustration (waifu2x CUnet Model)
41 | 2D illustration (waifu2x UpRGB Model)
42 | Photo (waifu2x UpPhoto Model)
43 | 2D illustration (Real-CUGAN se Model)
44 | 2D illustration (Real-CUGAN pro Model)
45 | Photo (Real-ESRGAN realesrgan-x4plus Model)
46 | Photo (Real-ESRGAN realesrnet-x4plus Model)
47 | 2D illustration (Real-ESRGAN realesrgan-x4plus-anime Model)
48 | 2D illustration (Real-ESRGAN realesr-animevideov3 Model)
49 | Photo (RealSR DF2K Model)
50 | Photo (RealSR DF2K_JPEG Model)
51 | Block Size
52 | Device
53 | GPU ID
54 |
55 | Preferences
56 |
57 | Store the last output path
58 | Output files No overwrite
59 | Play beep after processing
60 | Execute high precision processing (fp32 mode)
61 | Separate alpha channels with ImageMagick
62 | Keep aspect ratio
63 |
64 | Run!
65 |
66 | ABORT
67 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/pt-BR/UILang.pt-BR.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-pt-BR
5 |
6 | waifu2x-ncnn-vulkan multilingual GUI
7 | Sobre
8 | Ajuda
9 | Informação da Versão
10 |
11 | Configurações
12 |
13 | Origem:
14 | Destino:
15 | Abrir
16 | Limpar
17 | Definir
18 | Limpar
19 | Nome ou caminho. Campo OBRIGATÓRIO
20 | Caminho de destino. Se vazio, cria um novo arquivo na pasta original
21 | Extensão de saída
22 | Qualidade de saída
23 |
24 | Modo de Conversão
25 | Suavizar & Ampliar
26 | Somente Ampliar
27 | Somente Suavizar
28 | Tamanho da Ampliação
29 | Definir escala
30 | Definir largura (pixels)
31 | Definir altura (pixels)
32 | Definir resolução (pixels)
33 | Suavizar
34 | Ampliar & Suavizar (somente jpg)
35 | Nível 0
36 | Nível 1
37 | Nível 2
38 | Nível 3
39 | Modelo
40 | Ilustração 2D (waifu2x Modelo CUnet)
41 | Ilustração 2D (waifu2x Modelo UpRGB)
42 | Foto (waifu2x Modelo UpPhoto)
43 | Ilustração 2D (Real-CUGAN Modelo se)
44 | Ilustração 2D (Real-CUGAN Modelo pro)
45 | Foto (Real-ESRGAN Modelo realesrgan-x4plus)
46 | Foto (Real-ESRGAN Modelo realesrnet-x4plus)
47 | Ilustração 2D (Real-ESRGAN Modelo realesrgan-x4plus-anime)
48 | Ilustração 2D (Real-ESRGAN Modelo realesr-animevideov3)
49 | Foto(RealSR Modelo DF2K)
50 | Foto(RealSR Modelo DF2K_JPEG)
51 | Tamanho do Bloco
52 | Dispositivo
53 | ID da GPU
54 |
55 | Preferências
56 |
57 | Guardar o último caminho destino
58 | Não sobrescrever os arquivos
59 | Tocar um som após terminar de processar
60 | Executar processamento de alta precisão (modo fp32)
61 | Separar os canais Alfa com ImageMagick
62 | Manter a proporção
63 |
64 | Vai!
65 |
66 | PARE
67 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/es-AR/UILang.es-AR.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-es-AR
5 |
6 | waifu2x-ncnn-vulkan GUI multilingüe
7 | Acerca de
8 | Ayuda
9 | Info de Versión
10 |
11 | Ajustes
12 |
13 | Origen:
14 | Destino:
15 | Elegir Origen
16 | Vaciar
17 | Elegir Destino
18 | Vaciar
19 | Dirección de archivo o carpeta. Campo OBLIGATORIO
20 | Dirección de salida. Si queda vacío, se generará el archivo nuevo en carpeta de origen
21 | Extensión de salida
22 | Calidad de salida
23 |
24 | Modo de Conversión
25 | Reducir ruido y magnificar
26 | Solo magnificar
27 | Solo reducir ruido
28 | Tamaño Magnificado
29 | Fijar escala
30 | Fijar ancho (píxeles)
31 | Fijar altura (píxeles)
32 | Fijar resolución (píx.)
33 | Reducir Ruido
34 | Magnif. y red. ruido (sólo jpg)
35 | Nivel 0
36 | Nivel 1
37 | Nivel 2
38 | Nivel 3
39 | Modelo
40 | Illustración 2D (waifu2x Modelo CUnet)
41 | Illustración 2D (waifu2x Modelo UpRGB)
42 | Foto (waifu2x Modelo UpPhoto)
43 | Illustración 2D (Real-CUGAN Modelo se)
44 | Illustración 2D (Real-CUGAN Modelo pro)
45 | Foto (Real-ESRGAN Modelo realesrgan-x4plus)
46 | Foto (Real-ESRGAN Modelo realesrnet-x4plus)
47 | Illustración 2D (Real-ESRGAN Modelo realesrgan-x4plus-anime)
48 | Illustración 2D (Real-ESRGAN Modelo realesr-animevideov3)
49 | Foto (RealSR Modelo DF2K)
50 | Foto (RealSR Modelo DF2K_JPEG)
51 | Tamaño Bloque
52 | Dispositivo
53 | ID de GPU
54 |
55 | Preferencias
56 |
57 | Guardar última ubicación de destino
58 | No sobreescribir archivos
59 | Reproducir tono al finalizar
60 | Ejecutar procesado de alta precisión (modo fp32)
61 | Separar canal de transparencia (alpha) con ImageMagick
62 | Mantener relación de aspecto
63 |
64 | Ejecutar!
65 |
66 | Abortar
67 |
68 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/fr-FR/UILang.fr-FR.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-fr-FR
5 |
6 | waifu2x-ncnn-vulkan interface graphique multilingue
7 | À propos
8 | Aide
9 | Info de version
10 |
11 | Paramètres
12 |
13 | Source :
14 | Destination :
15 | Source
16 | Effacer
17 | Destination
18 | Effacer
19 | Nom de fichier ou emplacement de dossier. Champ REQUIS.
20 | Emplacement de destination. Si laissé vide, créera les fichiers dans le dossier source.
21 | Extension
22 | Qualité
23 |
24 | Mode de conversion
25 | Réduire le bruit & Agrandir
26 | Agrandir uniquement
27 | Réduire le bruit uniquement
28 | Agrandir & Réduire le bruit (jpg uniquement)
29 | Agrandissement
30 | Définir la proportion
31 | Définir la largeur (pixels)
32 | Définir la hauteur (pixels)
33 | Définir la résolution (pixels)
34 | Réduction du bruit
35 | Niveau 0
36 | Niveau 1
37 | Niveau 2
38 | Niveau 3
39 | Modèle
40 | Illustration 2D (modèle waifu2x CUnet)
41 | Illustration 2D (modèle waifu2x UpRGB)
42 | Photo (modèle waifu2x UpPhoto)
43 | Ilustration 2D (modèle Real-CUGAN se)
44 | Illustration 2D (modèle Real-CUGAN pro)
45 | Photo (modèle Real-ESRGAN realesrgan-x4plus)
46 | Photo (modèle Real-ESRGAN realesrnet-x4plus)
47 | Illustration 2D (modèle Real-ESRGAN realesrgan-x4plus-anime)
48 | Illustration 2D (modèle Real-ESRGAN realesr-animevideov3l)
49 | Photo (modèle RealSR DF2K)
50 | Photo (modèle RealSR DF2K_JPEG)
51 | Taille de bloc
52 | Matériel
53 | ID GPU
54 |
55 | Préférences
56 |
57 | Mémoriser le dernier emplacement de destination
58 | Convertir les fichiers sans écraser ceux existants
59 | Jouer un bip sonore à la fin du traitement
60 | Exécuter un traitement de haute précision (mode fp32)
61 | Séparer les couches alpha avec ImageMagick
62 | Maintenir le rapport L/H constant
63 |
64 | Exécuter
65 |
66 | ANNULER
67 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/it-IT/UILang.it-IT.xaml:
--------------------------------------------------------------------------------
1 |
4 | waifu2xui-it-IT
5 |
6 | Interfaccia Multilingue per waifu2x-ncnn-vulkan e simili
7 | Informazioni
8 | Aiuto
9 | Informazioni sulla versione
10 |
11 | Impostazioni
12 |
13 | Fonte:
14 | Destinazione:
15 | Fonte
16 | Cancella
17 | Destinazione
18 | Cancella
19 | Nome file o percorso della cartella. Campo OBBLIGATORIO
20 | Percorso di destinazione dell'output. Se vuoto, genera un nuovo file nella cartella di origine
21 | Tipo output
22 | Qualità dell'output
23 |
24 | Modalità di conversione
25 | Riduci rumore e ingrandisci
26 | Solo ingrandimento
27 | Solo riduzione rumore
28 | Ingrandisci e riduci rumore (solo jpg)
29 | Dimensione di ingrandimento
30 | Imposta tasso
31 | Imposta larghezza (pixel)
32 | Imposta altezza (pixel)
33 | Imposta risoluzione (pixel)
34 | Riduci rumore
35 | Livello 0
36 | Livello 1
37 | Livello 2
38 | Livello 3
39 | Modello
40 | Illustrazione 2D (Modello waifu2x CUnet)
41 | Illustrazione 2D (Modello waifu2x UpRGB)
42 | Foto (Modello waifu2x UpPhoto)
43 | Illustrazione 2D (Modello Real-CUGAN se)
44 | Illustrazione 2D (Modello Real-CUGAN pro)
45 | Foto (Modello Real-ESRGAN realesrgan-x4plus)
46 | Foto (Modello Real-ESRGAN realesrnet-x4plus)
47 | Illustrazione 2D (Modello Real-ESRGAN realesrgan-x4plus-anime)
48 | Illustrazione 2D (Modello Real-ESRGAN realesr-animevideov3)
49 | Foto (Modello RealSR DF2K)
50 | Foto (Modello RealSR DF2K_JPEG)
51 | Dimensione del blocco
52 | Dispositivo
53 | ID GPU
54 |
55 | Preferenze
56 |
57 | Memorizza l'ultimo percorso di output
58 | Se esistono, i file nella cartella output non saranno sovrascritti
59 | Riproduci beep dopo l'elaborazione
60 | Esegui elaborazione ad alta precisione (modalità fp32)
61 | Separa i canali alfa con ImageMagick
62 | Mantieni proporzioni
63 |
64 | Esegui!
65 |
66 | ANNULLA
67 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/waifu2x_ncnn_vulkan_gui.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {4EAA70AB-A23D-4FA3-A856-CEB76CC7BEB8}
8 | WinExe
9 | Properties
10 | waifu2x_ncnn_vulkan_gui
11 | waifu2x_ncnn_vulkan_gui
12 | v4.8
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 |
18 |
19 |
20 | AnyCPU
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 | true
40 | bin\x64\Debug\
41 | DEBUG;TRACE
42 | full
43 | x64
44 | prompt
45 | MinimumRecommendedRules.ruleset
46 | true
47 |
48 |
49 | bin\x64\Release\
50 | TRACE
51 | true
52 | pdbonly
53 | x64
54 | prompt
55 | MinimumRecommendedRules.ruleset
56 | true
57 |
58 |
59 | true
60 | bin\x86\Debug\
61 | DEBUG;TRACE
62 | full
63 | x86
64 | prompt
65 | MinimumRecommendedRules.ruleset
66 | true
67 |
68 |
69 | bin\x86\Release\
70 | TRACE
71 | true
72 | pdbonly
73 | x86
74 | prompt
75 | MinimumRecommendedRules.ruleset
76 | true
77 |
78 |
79 | MagGlass.ico
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | 4.0
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | MSBuild:Compile
102 | Designer
103 |
104 |
105 | MSBuild:Compile
106 | Designer
107 |
108 |
109 | App.xaml
110 | Code
111 |
112 |
113 | MainWindow.xaml
114 | Code
115 |
116 |
117 |
118 |
119 |
120 | Code
121 |
122 |
123 | True
124 | True
125 | Resources.resx
126 |
127 |
128 | True
129 | Settings.settings
130 | True
131 |
132 |
133 | ResXFileCodeGenerator
134 | Resources.Designer.cs
135 |
136 |
137 | SettingsSingleFileGenerator
138 | Settings.Designer.cs
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
154 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // O código foi gerado por uma ferramenta.
4 | // Versão de Tempo de Execução:4.0.30319.42000
5 | //
6 | // As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se
7 | // o código for gerado novamente.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace waifu2x_ncnn_vulkan_gui.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("2")]
29 | public string scale_ratio {
30 | get {
31 | return ((string)(this["scale_ratio"]));
32 | }
33 | set {
34 | this["scale_ratio"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
41 | public string noise_level {
42 | get {
43 | return ((string)(this["noise_level"]));
44 | }
45 | set {
46 | this["noise_level"] = value;
47 | }
48 | }
49 |
50 | [global::System.Configuration.UserScopedSettingAttribute()]
51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
52 | [global::System.Configuration.DefaultSettingValueAttribute("100")]
53 | public string block_size {
54 | get {
55 | return ((string)(this["block_size"]));
56 | }
57 | set {
58 | this["block_size"] = value;
59 | }
60 | }
61 |
62 | [global::System.Configuration.UserScopedSettingAttribute()]
63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
64 | [global::System.Configuration.DefaultSettingValueAttribute("scale")]
65 | public string mode {
66 | get {
67 | return ((string)(this["mode"]));
68 | }
69 | set {
70 | this["mode"] = value;
71 | }
72 | }
73 |
74 | [global::System.Configuration.UserScopedSettingAttribute()]
75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
76 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
77 | public bool SoundBeep {
78 | get {
79 | return ((bool)(this["SoundBeep"]));
80 | }
81 | set {
82 | this["SoundBeep"] = value;
83 | }
84 | }
85 |
86 | [global::System.Configuration.UserScopedSettingAttribute()]
87 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
88 | [global::System.Configuration.DefaultSettingValueAttribute("null")]
89 | public string output_dir {
90 | get {
91 | return ((string)(this["output_dir"]));
92 | }
93 | set {
94 | this["output_dir"] = value;
95 | }
96 | }
97 |
98 | [global::System.Configuration.UserScopedSettingAttribute()]
99 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
100 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
101 | public bool store_output_dir {
102 | get {
103 | return ((bool)(this["store_output_dir"]));
104 | }
105 | set {
106 | this["store_output_dir"] = value;
107 | }
108 | }
109 |
110 | [global::System.Configuration.UserScopedSettingAttribute()]
111 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
112 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
113 | public bool output_no_overwirit {
114 | get {
115 | return ((bool)(this["output_no_overwirit"]));
116 | }
117 | set {
118 | this["output_no_overwirit"] = value;
119 | }
120 | }
121 |
122 | [global::System.Configuration.UserScopedSettingAttribute()]
123 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
124 | [global::System.Configuration.DefaultSettingValueAttribute("models-cunet")]
125 | public string model {
126 | get {
127 | return ((string)(this["model"]));
128 | }
129 | set {
130 | this["model"] = value;
131 | }
132 | }
133 |
134 | [global::System.Configuration.UserScopedSettingAttribute()]
135 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
136 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
137 | public string gpu_id {
138 | get {
139 | return ((string)(this["gpu_id"]));
140 | }
141 | set {
142 | this["gpu_id"] = value;
143 | }
144 | }
145 |
146 | [global::System.Configuration.UserScopedSettingAttribute()]
147 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
148 | [global::System.Configuration.DefaultSettingValueAttribute("2")]
149 | public string thread {
150 | get {
151 | return ((string)(this["thread"]));
152 | }
153 | set {
154 | this["thread"] = value;
155 | }
156 | }
157 |
158 | [global::System.Configuration.UserScopedSettingAttribute()]
159 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
160 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
161 | public bool Precision_fp32 {
162 | get {
163 | return ((bool)(this["Precision_fp32"]));
164 | }
165 | set {
166 | this["Precision_fp32"] = value;
167 | }
168 | }
169 |
170 | [global::System.Configuration.UserScopedSettingAttribute()]
171 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
172 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
173 | public bool TTAmode {
174 | get {
175 | return ((bool)(this["TTAmode"]));
176 | }
177 | set {
178 | this["TTAmode"] = value;
179 | }
180 | }
181 |
182 | [global::System.Configuration.UserScopedSettingAttribute()]
183 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
184 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
185 | public bool Alphachannel_ImageMagick {
186 | get {
187 | return ((bool)(this["Alphachannel_ImageMagick"]));
188 | }
189 | set {
190 | this["Alphachannel_ImageMagick"] = value;
191 | }
192 | }
193 |
194 | [global::System.Configuration.UserScopedSettingAttribute()]
195 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
196 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
197 | public string output_format {
198 | get {
199 | return ((string)(this["output_format"]));
200 | }
201 | set {
202 | this["output_format"] = value;
203 | }
204 | }
205 |
206 | [global::System.Configuration.UserScopedSettingAttribute()]
207 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
208 | [global::System.Configuration.DefaultSettingValueAttribute("100")]
209 | public int output_quality {
210 | get {
211 | return ((int)(this["output_quality"]));
212 | }
213 | set {
214 | this["output_quality"] = value;
215 | }
216 | }
217 |
218 | [global::System.Configuration.UserScopedSettingAttribute()]
219 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
220 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
221 | public bool Keep_aspect_ratio {
222 | get {
223 | return ((bool)(this["Keep_aspect_ratio"]));
224 | }
225 | set {
226 | this["Keep_aspect_ratio"] = value;
227 | }
228 | }
229 |
230 | [global::System.Configuration.UserScopedSettingAttribute()]
231 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
232 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
233 | public string Output_width {
234 | get {
235 | return ((string)(this["Output_width"]));
236 | }
237 | set {
238 | this["Output_width"] = value;
239 | }
240 | }
241 |
242 | [global::System.Configuration.UserScopedSettingAttribute()]
243 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
244 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
245 | public string Output_heigh {
246 | get {
247 | return ((string)(this["Output_heigh"]));
248 | }
249 | set {
250 | this["Output_heigh"] = value;
251 | }
252 | }
253 |
254 | [global::System.Configuration.UserScopedSettingAttribute()]
255 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
256 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
257 | public string Output_width_height {
258 | get {
259 | return ((string)(this["Output_width_height"]));
260 | }
261 | set {
262 | this["Output_width_height"] = value;
263 | }
264 | }
265 |
266 | [global::System.Configuration.UserScopedSettingAttribute()]
267 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
268 | [global::System.Configuration.DefaultSettingValueAttribute("Scale_ratio_mode")]
269 | public string mag_mode {
270 | get {
271 | return ((string)(this["mag_mode"]));
272 | }
273 | set {
274 | this["mag_mode"] = value;
275 | }
276 | }
277 | }
278 | }
279 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | Error Log
168 |
169 |
170 |
--------------------------------------------------------------------------------
/waifu2x_i18n_gui/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel; // CancelEventArgs
4 | using System.Diagnostics;
5 | using System.Globalization;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Text.RegularExpressions;
10 | using System.Threading;
11 | using System.Threading.Tasks;
12 | using System.Windows;
13 | using System.Windows.Controls;
14 | using System.Windows.Threading;
15 | using Microsoft.Win32;
16 | using Forms = System.Windows.Forms;
17 |
18 | namespace waifu2x_ncnn_vulkan_gui
19 | {
20 | ///
21 | /// Interaction logic for MainWindow.xaml
22 | ///
23 | public partial class MainWindow : Window
24 | {
25 | public MainWindow()
26 | {
27 | InitializeComponent();
28 | System.Environment.CurrentDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
29 | var dirInfo = new DirectoryInfo(App.directory);
30 | var langlist = dirInfo.GetFiles("UILang.*.xaml");
31 | string[] langcodelist = new string[langlist.Length];
32 | for (int i = 0; i < langlist.Length; i++)
33 | {
34 | var fn_parts = langlist[i].ToString().Split('.');
35 | langcodelist[i] = fn_parts[1];
36 | }
37 |
38 | foreach (var langcode in langcodelist)
39 | {
40 | MenuItem mi = new MenuItem();
41 | mi.Tag = langcode;
42 | mi.Header = langcode;
43 | mi.Click += new RoutedEventHandler(MenuItem_Style_Click);
44 | menuLang.Items.Add(mi);
45 | }
46 | foreach (MenuItem item in menuLang.Items)
47 | {
48 | if (item.Tag.ToString().Equals(CultureInfo.CurrentUICulture.Name))
49 | {
50 | item.IsChecked = true;
51 | }
52 | }
53 | // Load settings from file
54 |
55 | if (Properties.Settings.Default.output_dir != "null")
56 | { txtDstPath.Text = Properties.Settings.Default.output_dir; }
57 | txtOutExt.SelectedValue = Properties.Settings.Default.output_format;
58 | txtOutQuality.Text = Properties.Settings.Default.output_quality.ToString();
59 |
60 | if (System.Text.RegularExpressions.Regex.IsMatch(
61 | Properties.Settings.Default.gpu_id,
62 | @"^\d+$",
63 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
64 | {
65 | txtGPU_ID.Text = Properties.Settings.Default.gpu_id;
66 | }
67 |
68 | txtBlocksize.Text = Properties.Settings.Default.block_size;
69 | txtScale_ratio.Text = Properties.Settings.Default.scale_ratio;
70 | txtOutput_width.Text = Properties.Settings.Default.Output_width;
71 | txtOutput_height.Text = Properties.Settings.Default.Output_heigh;
72 | txtOutput_width_height.Text = Properties.Settings.Default.Output_width_height;
73 | txtBlocksize.Text = Properties.Settings.Default.block_size;
74 | txtThread.Text = Properties.Settings.Default.thread;
75 |
76 | //btnCUDA.IsChecked = true;
77 | btnDenoise0.IsChecked = true;
78 |
79 | if (Properties.Settings.Default.noise_level == "3")
80 | { btnDenoise3.IsChecked = true; }
81 | if (Properties.Settings.Default.noise_level == "2")
82 | { btnDenoise2.IsChecked = true; }
83 | if (Properties.Settings.Default.noise_level == "1")
84 | { btnDenoise1.IsChecked = true; }
85 | if (Properties.Settings.Default.noise_level == "0")
86 | { btnDenoise0.IsChecked = true; }
87 |
88 | btnModeScale.IsChecked = true;
89 |
90 | if (Properties.Settings.Default.mode == "scale")
91 | { btnModeScale.IsChecked = true; }
92 | if (Properties.Settings.Default.mode == "noise_scale")
93 | { btnModeNoiseScale.IsChecked = true; }
94 | if (Properties.Settings.Default.mode == "noise")
95 | { btnModeNoise.IsChecked = true; }
96 | if (Properties.Settings.Default.mode == "auto_scale")
97 | { btnModeAutoScale.IsChecked = true; }
98 |
99 | txtModel.SelectedValue = Properties.Settings.Default.model;
100 |
101 | if (Properties.Settings.Default.mag_mode == "Scale_ratio_mode")
102 | { btnScale_ratio.IsChecked = true; }
103 | if (Properties.Settings.Default.mag_mode == "Width_mode")
104 | { btnOutput_width.IsChecked = true; }
105 | if (Properties.Settings.Default.mag_mode == "Height_mode")
106 | { btnOutput_height.IsChecked = true; }
107 | if (Properties.Settings.Default.mag_mode == "Width_height_mode")
108 | { btnOutput_width_height.IsChecked = true; }
109 |
110 | checkTTAmode.IsChecked = Properties.Settings.Default.TTAmode;
111 | checkSoundBeep.IsChecked = Properties.Settings.Default.SoundBeep;
112 | checkStore_output_dir.IsChecked = Properties.Settings.Default.store_output_dir;
113 | checkOutput_no_overwirit.IsChecked = Properties.Settings.Default.output_no_overwirit;
114 | checkPrecision_fp32.IsChecked = Properties.Settings.Default.Precision_fp32;
115 | checkAlphachannel_ImageMagick.IsChecked = Properties.Settings.Default.Alphachannel_ImageMagick;
116 | checkKeep_aspect_ratio.IsChecked = Properties.Settings.Default.Keep_aspect_ratio;
117 | txtScale_ratio.Text = Properties.Settings.Default.scale_ratio;
118 |
119 | }
120 | System.Diagnostics.Stopwatch Stopwatch = new System.Diagnostics.Stopwatch();
121 | // public static StringBuilder param_src= new StringBuilder("");
122 | public static StringBuilder param_dst = new StringBuilder("");
123 | public static StringBuilder param_dst_suffix = new StringBuilder("");
124 | public static StringBuilder param_outformat = new StringBuilder("png");
125 | public static StringBuilder param_output_quality = new StringBuilder("-quality 100");
126 | public static StringBuilder param_mag_mode = new StringBuilder("Scale_ratio_mode");
127 | public static StringBuilder param_denoise = new StringBuilder("");
128 | public static StringBuilder param_denoise2 = new StringBuilder("");
129 | public static StringBuilder param_model = new StringBuilder("models-cunet");
130 | public static StringBuilder param_model2 = new StringBuilder("models-cunet");
131 | public static StringBuilder param_block = new StringBuilder("100");
132 | public static StringBuilder param_mode = new StringBuilder("noise_scale");
133 | public static StringBuilder param_mode2 = new StringBuilder("noise_scale");
134 | public static StringBuilder param_gpu_id = new StringBuilder("0");
135 | public static StringBuilder param_thread = new StringBuilder("2");
136 | public static StringBuilder param_tta = new StringBuilder("");
137 | public static StringBuilder binary_path = new StringBuilder("");
138 | public static StringBuilder binary_type = new StringBuilder("");
139 | public static String[] param_src;
140 | // public static int scale_ratio;
141 | public static float scale_ratio_public;
142 | public static int FileCount = 0;
143 | public static int output_width_public = 0;
144 | public static int output_height_public = 0;
145 | public DateTime starttimea;
146 | public static bool Cancel = false;
147 | public static bool Output_no_overwirit;
148 | public static bool Keep_aspect_ratio = false;
149 | public static bool Alphachannel_ImageMagick;
150 | public static bool txtScale_ratio_exponent = false;
151 |
152 | void MainWindow_Closing(object sender, CancelEventArgs e)
153 | {
154 |
155 | // Save settings
156 |
157 | // Remember last output path
158 | if (checkStore_output_dir.IsChecked == true)
159 | {
160 | if (txtDstPath.Text.Trim() != "")
161 | {
162 | Properties.Settings.Default.output_dir = txtDstPath.Text;
163 | }
164 | else
165 | {
166 | Properties.Settings.Default.output_dir = "null";
167 | }
168 |
169 | }
170 | else
171 | {
172 | Properties.Settings.Default.output_dir = "null";
173 | }
174 | Properties.Settings.Default.output_format = txtOutExt.SelectedValue.ToString();
175 | Properties.Settings.Default.output_no_overwirit = Convert.ToBoolean(checkOutput_no_overwirit.IsChecked);
176 | Properties.Settings.Default.model = param_model.ToString().Replace("-m ", "").Replace("-n ", "");
177 | Properties.Settings.Default.TTAmode = Convert.ToBoolean(checkTTAmode.IsChecked);
178 | Properties.Settings.Default.SoundBeep = Convert.ToBoolean(checkSoundBeep.IsChecked);
179 | Properties.Settings.Default.store_output_dir = Convert.ToBoolean(checkStore_output_dir.IsChecked);
180 | Properties.Settings.Default.Precision_fp32 = Convert.ToBoolean(checkPrecision_fp32.IsChecked);
181 | Properties.Settings.Default.Alphachannel_ImageMagick = Convert.ToBoolean(checkAlphachannel_ImageMagick.IsChecked);
182 | Properties.Settings.Default.Keep_aspect_ratio = Convert.ToBoolean(checkKeep_aspect_ratio.IsChecked);
183 | Properties.Settings.Default.mode = param_mode.ToString();
184 | Properties.Settings.Default.noise_level = param_denoise.ToString();
185 | Properties.Settings.Default.mag_mode = param_mag_mode.ToString();
186 |
187 | if (System.Text.RegularExpressions.Regex.IsMatch(
188 | txtScale_ratio.Text,
189 | @"^\d+(\.\d+)?$",
190 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
191 | {
192 | Properties.Settings.Default.scale_ratio = txtScale_ratio.Text;
193 | }
194 | else
195 | {
196 | Properties.Settings.Default.scale_ratio = "2";
197 | }
198 |
199 | if (System.Text.RegularExpressions.Regex.IsMatch(
200 | txtOutput_width.Text,
201 | @"^\d+$",
202 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
203 | {
204 | Properties.Settings.Default.Output_width = txtOutput_width.Text;
205 | }
206 | else
207 | {
208 | Properties.Settings.Default.Output_width = "0";
209 | }
210 |
211 |
212 | if (System.Text.RegularExpressions.Regex.IsMatch(
213 | txtOutput_height.Text,
214 | @"^\d+$",
215 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
216 | {
217 | Properties.Settings.Default.Output_heigh = txtOutput_height.Text;
218 | }
219 | else
220 | {
221 | Properties.Settings.Default.Output_heigh = "0";
222 | }
223 |
224 | if (System.Text.RegularExpressions.Regex.IsMatch(
225 | txtOutput_width_height.Text,
226 | @"^\d+x\d+$",
227 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
228 | {
229 | Properties.Settings.Default.Output_width_height = txtOutput_width_height.Text;
230 | }
231 | else
232 | {
233 | Properties.Settings.Default.Output_width_height = "1920x1080";
234 | }
235 |
236 | if (System.Text.RegularExpressions.Regex.IsMatch(
237 | txtOutQuality.Text,
238 | @"^\d+$",
239 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
240 | {
241 | Properties.Settings.Default.output_quality = int.Parse(txtOutQuality.Text);
242 | }
243 | else
244 | {
245 | Properties.Settings.Default.output_quality = 100;
246 | }
247 |
248 | if (System.Text.RegularExpressions.Regex.IsMatch(
249 | txtBlocksize.Text,
250 | @"^\d+$",
251 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
252 | {
253 | Properties.Settings.Default.block_size = txtBlocksize.Text;
254 | }
255 | else
256 | {
257 | Properties.Settings.Default.block_size = "100";
258 | }
259 |
260 | if (System.Text.RegularExpressions.Regex.IsMatch(
261 | txtGPU_ID.Text,
262 | @"^\d+$",
263 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
264 | {
265 | Properties.Settings.Default.gpu_id = txtGPU_ID.Text;
266 | }
267 | else
268 | {
269 | Properties.Settings.Default.gpu_id = "Unspecified";
270 | }
271 |
272 | if (System.Text.RegularExpressions.Regex.IsMatch(
273 | txtThread.Text,
274 | @"^\d+$",
275 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
276 | {
277 | Properties.Settings.Default.thread = txtThread.Text;
278 | }
279 | else
280 | {
281 | Properties.Settings.Default.thread = "2";
282 | }
283 |
284 | Properties.Settings.Default.Save();
285 |
286 | Cancel = true;
287 | try
288 | {
289 | foreach (var process in Process.GetProcessesByName("waifu2x-ncnn-vulkan"))
290 | {
291 | process.Kill();
292 | }
293 | }
294 | catch { }
295 | }
296 |
297 | private void OnMenuHelpClick(object sender, RoutedEventArgs e)
298 | {
299 | string msg =
300 | "This is a multilingual graphical user-interface\n" +
301 | "for the waifu2x-ncnn-vulkan commandline program.\n" +
302 | "DO NOT rename any subdirectories inside waifu2x-ncnn-vulkan folder\n" +
303 | "To make a translation, copy one of the bundled xaml file\n" +
304 | "then edit the copy with a text editor.\n" +
305 | "Whenever you see a language code like en-US, change it to\n" +
306 | "the target language code like zh-TW, ja-JP.\n" +
307 | "The filename needs to be changed too.\n" +
308 | "Translators: @yoaan, @xperiazu21, @MartBlur,\n" +
309 | "@martin-varela, @laikal, @flavw";
310 | MessageBox.Show(msg);
311 | }
312 |
313 | private void OnMenuVersionClick(object sender, RoutedEventArgs e)
314 | {
315 | string msg =
316 | "Multilingual GUI for waifu2x-ncnn-vulkan\n" +
317 | "By f11894 and Flavw\n" +
318 | "Version 2.1.1.2\n" +
319 | "BuildDate: 2023/02/20\n" +
320 | "License: MIT License";
321 | MessageBox.Show(msg);
322 | }
323 |
324 | private void OnBtnSrc(object sender, RoutedEventArgs e)
325 | {
326 | OpenFileDialog fdlg = new OpenFileDialog();
327 | fdlg.Multiselect = true;
328 | fdlg.Filter = "Graphic Files(*.png;*.jpg;*jpeg;*.gif;*.bmp;*.tif;*.tiff;*.webp)|*.png;*.jpg;*jpeg;*.gif;*.bmp;*.tif;*.tiff;*.webp|All Files(*.*)|*.*";
329 | if (fdlg.ShowDialog() == true)
330 | {
331 | this.txtSrcPath.Text = string.Join("\n", fdlg.FileNames);
332 | param_src = fdlg.FileNames;
333 | }
334 | }
335 |
336 | private void OnSrcClear(object sender, RoutedEventArgs e)
337 | {
338 | this.txtSrcPath.Clear();
339 | param_src = null;
340 | }
341 |
342 | private void OnBtnDst(object sender, RoutedEventArgs e)
343 | {
344 | var dlg = new Forms.FolderBrowserDialog();
345 | if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
346 | {
347 | this.txtDstPath.Text = dlg.SelectedPath;
348 | }
349 | }
350 |
351 | private void OnDstClear(object sender, RoutedEventArgs e)
352 | {
353 | this.txtDstPath.Clear();
354 | }
355 |
356 | private void MenuItem_Style_Click(object sender, RoutedEventArgs e)
357 | {
358 | foreach (MenuItem item in menuLang.Items)
359 | {
360 | item.IsChecked = false;
361 | }
362 | MenuItem mi = (MenuItem)sender;
363 | mi.IsChecked = true;
364 | App.Instance.SwitchLanguage(mi.Tag.ToString());
365 | }
366 |
367 | private void On_DragOver(object sender, DragEventArgs e)
368 | {
369 | if (e.Data.GetDataPresent(DataFormats.FileDrop))
370 | {
371 | e.Effects = DragDropEffects.All;
372 | }
373 | else
374 | {
375 | e.Effects = DragDropEffects.None;
376 | }
377 |
378 | e.Handled = true;
379 | }
380 |
381 | private void On_SrcDrop(object sender, DragEventArgs e)
382 | {
383 | if (e.Data.GetDataPresent(DataFormats.FileDrop))
384 | {
385 | string[] fn = (string[])e.Data.GetData(DataFormats.FileDrop);
386 | this.txtSrcPath.Text = string.Join("\n", fn);
387 | param_src = (string[])e.Data.GetData(DataFormats.FileDrop);
388 | }
389 | }
390 |
391 | private void On_DstDrop(object sender, DragEventArgs e)
392 | {
393 | if (e.Data.GetDataPresent(DataFormats.FileDrop))
394 | {
395 | string[] fn = (string[])e.Data.GetData(DataFormats.FileDrop);
396 | this.txtDstPath.Text = fn[0];
397 | }
398 | }
399 |
400 | private void OnSetModeChecked(object sender, RoutedEventArgs e)
401 | {
402 | gpDenoise.IsEnabled = true;
403 | if (btnModeNoise.IsChecked == false)
404 | {
405 | gpScale.IsEnabled = true;
406 | gpScale2.IsEnabled = true;
407 | }
408 |
409 | param_mode.Clear();
410 | RadioButton optsrc = sender as RadioButton;
411 | param_mode.Append(optsrc.Tag.ToString());
412 | if (btnModeScale.IsChecked == true)
413 | { gpDenoise.IsEnabled = false; }
414 |
415 | if (btnModeNoise.IsChecked == true)
416 | {
417 | gpScale.IsEnabled = false;
418 | gpScale2.IsEnabled = false;
419 | }
420 | }
421 |
422 | private void OnScaleModeChecked(object sender, RoutedEventArgs e)
423 | {
424 | param_mag_mode.Clear();
425 | RadioButton optsrc = sender as RadioButton;
426 | param_mag_mode.Append(optsrc.Tag.ToString());
427 | txtOutput_width.IsEnabled = false;
428 | txtOutput_height.IsEnabled = false;
429 | txtOutput_width_height.IsEnabled = false;
430 | txtScale_ratio.IsEnabled = false;
431 | if (btnScale_ratio.IsChecked == true)
432 | { txtScale_ratio.IsEnabled = true; }
433 | if (btnOutput_width.IsChecked == true)
434 | { txtOutput_width.IsEnabled = true; }
435 | if (btnOutput_height.IsChecked == true)
436 | { txtOutput_height.IsEnabled = true; }
437 | if (btnOutput_width_height.IsChecked == true)
438 | { txtOutput_width_height.IsEnabled = true; }
439 | }
440 | private void OnDenoiseChecked(object sender, RoutedEventArgs e)
441 | {
442 | param_denoise.Clear();
443 | RadioButton optsrc = sender as RadioButton;
444 | param_denoise.Append(optsrc.Tag.ToString());
445 | }
446 |
447 | /*private void OnDeviceChecked(object sender, RoutedEventArgs e)
448 | {
449 | param_gpu_id.Clear();
450 | RadioButton optsrc= sender as RadioButton;
451 | param_gpu_id.Append(optsrc.Tag.ToString());
452 | }
453 | */
454 |
455 | private void OnModelChecked(object sender, RoutedEventArgs e)
456 | {
457 | ComboBoxItem optsrc = sender as ComboBoxItem;
458 | param_model.Clear();
459 | if (optsrc.Tag.ToString() == "realesrgan-x4plus" || optsrc.Tag.ToString() == "realesrnet-x4plus" || optsrc.Tag.ToString() == "realesrgan-x4plus-anime" || optsrc.Tag.ToString() == "realesr-animevideov3")
460 | {
461 | param_model.Append("-n ");
462 | param_model.Append(optsrc.Tag.ToString());
463 | btnModeScale.IsChecked = true;
464 | btnModeNoiseScale.IsEnabled = false;
465 | btnModeNoise.IsEnabled = false;
466 | btnModeAutoScale.IsEnabled = false;
467 | }
468 | else if (optsrc.Tag.ToString() == "models-DF2K" || optsrc.Tag.ToString() == "models-DF2K_JPEG")
469 | {
470 | param_model.Append("-m ");
471 | param_model.Append(optsrc.Tag.ToString());
472 | btnModeScale.IsChecked = true;
473 | btnModeNoiseScale.IsEnabled = false;
474 | btnModeNoise.IsEnabled = false;
475 | btnModeAutoScale.IsEnabled = false;
476 | }
477 | else
478 | {
479 | param_model.Append("-m ");
480 | param_model.Append(optsrc.Tag.ToString());
481 | btnModeNoiseScale.IsEnabled = true;
482 | btnModeNoise.IsEnabled = true;
483 | btnModeAutoScale.IsEnabled = true;
484 | }
485 | if (optsrc.Tag.ToString() == "models-pro")
486 | {
487 | if (param_denoise.ToString() == "1" || param_denoise.ToString() == "2")
488 | { btnDenoise0.IsChecked = true; }
489 | btnDenoise1.IsEnabled = false;
490 | btnDenoise2.IsEnabled = false;
491 | }
492 | else
493 | {
494 | btnDenoise1.IsEnabled = true;
495 | btnDenoise2.IsEnabled = true;
496 | }
497 | }
498 | private async void OnAbort(object sender, RoutedEventArgs e)
499 | {
500 | Cancel = true;
501 | this.btnRun.IsEnabled = true;
502 | this.btnAbort.IsEnabled = false;
503 | string[] process_array = new string[6] { "waifu2x-ncnn-vulkan", "waifu2x-ncnn-vulkan-fp32", "realcugan-ncnn-vulkan", "realesrgan-ncnn-vulkan", "realsr-ncnn-vulkan", "magick" };
504 | try
505 | {
506 | for (int i = 0; i < process_array.Length; i++)
507 | {
508 | foreach (var process in Process.GetProcessesByName(process_array[i]))
509 | {
510 | process.Kill();
511 | }
512 | }
513 |
514 | }
515 | catch { }
516 | }
517 | public void tasks_waifu2x(int maxConcurrency, int FileCount, string mag_mode_local, string mode_local)
518 | {
519 | DateTime starttime = DateTime.Now;
520 | starttimea = starttime;
521 | string labelstring = FileCount.ToString();
522 | pLabel.Dispatcher.Invoke(() => pLabel.Content = "0 / " + prgbar.Maximum, DispatcherPriority.Background);
523 |
524 | using (SemaphoreSlim concurrencySemaphore = new SemaphoreSlim(maxConcurrency))
525 | {
526 | List tasks = new List();
527 | Task file_t = Task.Factory.StartNew(() => { });
528 | Task directory_t = Task.Factory.StartNew(() => { });
529 | foreach (var input in param_src)
530 | {
531 | if (File.Exists(input))
532 | {
533 | concurrencySemaphore.Wait();
534 | file_t = Task.Factory.StartNew(() =>
535 | {
536 | try
537 | {
538 | TimeSpan timespent;
539 | if (Cancel == false)
540 | {
541 | string input_image = input;
542 | string output_final = null;
543 | if (param_dst.ToString().Trim() == "")
544 | {
545 | output_final = System.IO.Directory.GetParent(input_image) + "\\" + System.IO.Path.GetFileNameWithoutExtension(input_image) + param_dst_suffix + "." + param_outformat;
546 | }
547 | else
548 | {
549 | output_final = param_dst + "\\" + System.IO.Path.GetFileNameWithoutExtension(input_image) + param_dst_suffix + "." + param_outformat;
550 | }
551 | if (Output_no_overwirit == true)
552 | {
553 | if (File.Exists(output_final))
554 | {
555 | prgbar.Dispatcher.Invoke(() => prgbar.Value += 1, DispatcherPriority.Background);
556 | timespent = DateTime.Now - starttime;
557 | pLabel.Dispatcher.Invoke(() => pLabel.Content = prgbar.Value + " / " + labelstring + " - Time Left: " + new TimeSpan(0, 0, Convert.ToInt32(Math.Round(((timespent.TotalSeconds / prgbar.Value) * (Int32.Parse(labelstring) - prgbar.Value)), MidpointRounding.ToEven))).ToString(@"hh\:mm\:ss"), DispatcherPriority.Background);
558 | return;
559 | }
560 | }
561 | run_waifu2x(input_image, output_final, mag_mode_local, mode_local);
562 | timespent = DateTime.Now - starttime;
563 | if (Cancel == false)
564 | {
565 | prgbar.Dispatcher.Invoke(() => prgbar.Value += 1, DispatcherPriority.Background);
566 | pLabel.Dispatcher.Invoke(() => pLabel.Content = prgbar.Value + " / " + labelstring + " - Time Left: " + new TimeSpan(0, 0, Convert.ToInt32(Math.Round(((timespent.TotalSeconds / prgbar.Value) * (Int32.Parse(labelstring) - prgbar.Value)), MidpointRounding.ToEven))).ToString(@"hh\:mm\:ss"), DispatcherPriority.Background);
567 | }
568 | }
569 | }
570 |
571 | finally
572 | {
573 | concurrencySemaphore.Release();
574 | }
575 | });
576 | }
577 | if (Directory.Exists(input))
578 | {
579 | var reg = new Regex(@".+\.(jpe?g|png|bmp|gif|tiff?|webp)$", RegexOptions.IgnoreCase);
580 | var Directoryfiles = Directory.GetFiles((input), "*", SearchOption.AllDirectories).Where(f => reg.IsMatch(f)).ToArray();
581 | foreach (var Directoryimage in Directoryfiles)
582 | {
583 | string relative_path = System.IO.Path.GetDirectoryName(Directoryimage).Replace(input, "");
584 | string output_dir = null;
585 | concurrencySemaphore.Wait();
586 | directory_t = Task.Factory.StartNew(() =>
587 | {
588 | try
589 | {
590 | TimeSpan timespent;
591 | if (Cancel == false)
592 | {
593 | string input_image = Directoryimage;
594 | string output_final = null;
595 | if (param_dst.ToString().Trim() == "")
596 | {
597 | output_dir = input + param_dst_suffix + relative_path;
598 | }
599 | else
600 | {
601 | output_dir = param_dst + relative_path;
602 | }
603 | output_final = output_dir + "\\" + System.IO.Path.GetFileNameWithoutExtension(input_image) + "." + param_outformat;
604 |
605 | if (Output_no_overwirit == true)
606 | {
607 | if (File.Exists(output_final))
608 | {
609 | prgbar.Dispatcher.Invoke(() => prgbar.Value += 1, DispatcherPriority.Background);
610 | timespent = DateTime.Now - starttime;
611 | pLabel.Dispatcher.Invoke(() => pLabel.Content = prgbar.Value + " / " + labelstring + " - Time Left: " + new TimeSpan(0, 0, Convert.ToInt32(Math.Round(((timespent.TotalSeconds / prgbar.Value) * (Int32.Parse(labelstring) - prgbar.Value)), MidpointRounding.ToEven))).ToString(@"hh\:mm\:ss"), DispatcherPriority.Background);
612 | return;
613 | }
614 | }
615 |
616 | try
617 | {
618 | Directory.CreateDirectory(output_dir);
619 | }
620 | catch
621 | {
622 | MessageBox.Show(@"Failed to create folder!");
623 | return;
624 | }
625 | run_waifu2x(input_image, output_final, mag_mode_local, mode_local);
626 | timespent = DateTime.Now - starttime;
627 | if (Cancel == false)
628 | {
629 | prgbar.Dispatcher.Invoke(() => prgbar.Value += 1, DispatcherPriority.Background);
630 | pLabel.Dispatcher.Invoke(() => pLabel.Content = prgbar.Value + " / " + labelstring + " - Time Left: " + new TimeSpan(0, 0, Convert.ToInt32(Math.Round(((timespent.TotalSeconds / prgbar.Value) * (Int32.Parse(labelstring) - prgbar.Value)), MidpointRounding.ToEven))).ToString(@"hh\:mm\:ss"), DispatcherPriority.Background);
631 | }
632 | }
633 | }
634 |
635 | finally
636 | {
637 | concurrencySemaphore.Release();
638 | }
639 | });
640 | }
641 | }
642 | }
643 | tasks.Add(file_t);
644 | tasks.Add(directory_t);
645 | Task.WaitAll(tasks.ToArray());
646 | }
647 | }
648 |
649 | private void run_waifu2x(string input_image, string output_final, string mag_mode_local, string mode_local)
650 | {
651 | string others_param = String.Join(" ",
652 | param_model2,
653 | param_block,
654 | param_tta,
655 | param_gpu_id);
656 |
657 | Process process = new Process();
658 | ProcessStartInfo startInfo = new ProcessStartInfo();
659 | startInfo.UseShellExecute = false;
660 | startInfo.CreateNoWindow = true;
661 | startInfo.RedirectStandardError = true;
662 | startInfo.RedirectStandardOutput = true;
663 | startInfo.FileName = System.Environment.GetEnvironmentVariable("ComSpec");
664 | startInfo.WorkingDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
665 |
666 | string noise_level_temp = null;
667 | string noise_level_temp2 = null;
668 | string Magick_resize_option = "";
669 | string output_temp = null;
670 | string output_rgb_temp = null;
671 | string output_alpha_temp = null;
672 | string input_temp = null;
673 | string input_rgb_temp = null;
674 | string input_alpha_temp = null;
675 | for (int retryCount = 0; retryCount <= 5; retryCount++)
676 | {
677 | Guid g = System.Guid.NewGuid();
678 | string random32 = (g.ToString("N").Substring(0, 32));
679 | if (binary_type.ToString() == "waifu2x" || binary_type.ToString() == "realcugan")
680 | {
681 | noise_level_temp2 = "-n -1";
682 | if (!System.Text.RegularExpressions.Regex.IsMatch(System.IO.Path.GetExtension(input_image), @"\.jpe?g", RegexOptions.IgnoreCase) && param_mode2.ToString() == "auto_scale")
683 | {
684 | noise_level_temp = "-n -1";
685 | }
686 | else
687 | {
688 | noise_level_temp = param_denoise2.ToString();
689 | }
690 | }
691 |
692 | bool AlphaHas = false;
693 | int Image_Width = 0;
694 | int Image_Height = 0;
695 | if (Alphachannel_ImageMagick == true) if (!System.Text.RegularExpressions.Regex.IsMatch(System.IO.Path.GetExtension(input_image), @"\.jpe?g", RegexOptions.IgnoreCase))
696 | {
697 | try
698 | {
699 | startInfo.Arguments = "/C .\\ImageMagick\\magick.exe identify -format %A \"" + input_image + "\"";
700 | process.StartInfo = startInfo;
701 | process.Start();
702 | string IsAlphaPixelFormat = process.StandardOutput.ReadToEnd();
703 | process.WaitForExit();
704 | if (IsAlphaPixelFormat == "Blend")
705 | {
706 | AlphaHas = true;
707 | }
708 | }
709 | catch
710 | {
711 | // 画像の情報を調べるのに失敗
712 | }
713 | }
714 | try
715 | {
716 | startInfo.Arguments = "/C .\\ImageMagick\\magick.exe identify -format %Wx%H \"" + input_image + "\"";
717 | process.StartInfo = startInfo;
718 | process.Start();
719 | string identify_WxH = process.StandardOutput.ReadToEnd();
720 | process.WaitForExit();
721 | if (System.Text.RegularExpressions.Regex.IsMatch(
722 | identify_WxH,
723 | @"^(\d+x\d+)$",
724 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
725 | {
726 | string[] width_height = identify_WxH.Split('x');
727 | Image_Width = int.Parse(width_height[0]);
728 | Image_Height = int.Parse(width_height[1]);
729 | }
730 | else
731 | {
732 | break;
733 | }
734 |
735 | }
736 | catch
737 | {
738 | // 画像の情報を調べるのに失敗
739 | }
740 | int scale_ratio_local = (int)Math.Round(scale_ratio_public);
741 | int output_width_local = output_width_public;
742 | int output_height_local = output_height_public;
743 | if (mode_local != "noise" && mag_mode_local == "Scale_ratio_mode" && txtScale_ratio_exponent == false)
744 | {
745 | output_width_local = (int)Math.Round(Image_Width * scale_ratio_public, MidpointRounding.AwayFromZero);
746 | output_height_local = (int)Math.Round(Image_Height * scale_ratio_public, MidpointRounding.AwayFromZero);
747 | Magick_resize_option = " -resize " + output_width_local + "x" + output_height_local + "! ";
748 | }
749 |
750 | if (mode_local != "noise" && output_width_local + output_height_local != 0)
751 | {
752 | scale_ratio_local = 2;
753 | if (Keep_aspect_ratio == true && mag_mode_local == "Width_height_mode")
754 | {
755 | while (true)
756 | {
757 | if (output_width_local <= Image_Width * scale_ratio_local) break;
758 | if (output_height_local <= Image_Height * scale_ratio_local) break;
759 | scale_ratio_local = scale_ratio_local * 2;
760 | if (Cancel == true) return;
761 | }
762 | }
763 | else
764 | {
765 | while (true)
766 | {
767 | if (output_width_local <= Image_Width * scale_ratio_local) break;
768 | scale_ratio_local = scale_ratio_local * 2;
769 | if (Cancel == true) return;
770 | }
771 | while (true)
772 | {
773 | if (output_height_local <= Image_Height * scale_ratio_local) break;
774 | scale_ratio_local = scale_ratio_local * 2;
775 | if (Cancel == true) return;
776 | }
777 | }
778 | }
779 | if (mag_mode_local == "Width_mode")
780 | { Magick_resize_option = " -resize " + output_width_local + "x "; }
781 | if (mag_mode_local == "Height_mode")
782 | { Magick_resize_option = " -resize " + "x" + output_height_local + " "; }
783 | if (mag_mode_local == "Width_height_mode")
784 | {
785 | if (Keep_aspect_ratio == true)
786 | {
787 | Magick_resize_option = " -resize " + output_width_local + "x" + output_height_local + " ";
788 | }
789 | else
790 | {
791 | Magick_resize_option = " -resize " + output_width_local + "x" + output_height_local + "! ";
792 | }
793 | }
794 |
795 | int r = 1;
796 | int r2 = 1;
797 | int run_times = 1;
798 | string mag_value = "2";
799 |
800 | if (binary_type.ToString() == "realsr")
801 | {
802 | mag_value = "4";
803 | r = r * 4;
804 | }
805 | else if (binary_type.ToString() == "realesrgan")
806 | {
807 | if (param_model2.ToString().Replace("-n ", "") == "realesr-animevideov3" && r * 2 >= scale_ratio_local)
808 | {
809 | mag_value = "2";
810 | r = r * 2;
811 | }
812 | else
813 | {
814 | mag_value = "4";
815 | r = r * 4;
816 | }
817 | }
818 | else if (binary_type.ToString() == "realcugan")
819 | {
820 | if (param_model2.ToString().Replace("-m ", "") == "models-se" && noise_level_temp != "-n 1" && noise_level_temp != "-n 2" && r * 4 <= scale_ratio_local)
821 | {
822 | mag_value = "4";
823 | r = r * 4;
824 | }
825 | else
826 | {
827 | mag_value = "2";
828 | r = r * 2;
829 | }
830 | }
831 | else
832 | {
833 | mag_value = "2";
834 | r = r * 2;
835 | }
836 | if (scale_ratio_public == 1 && mode_local == "noise")
837 | {
838 | r = 1;
839 | mag_value = "1";
840 | scale_ratio_local = 1;
841 | }
842 |
843 | // debug code
844 | /*
845 | string debug_txt = System.IO.Path.ChangeExtension(output_final, "txt");
846 | Encoding enc_debug = Encoding.UTF8;
847 | StreamWriter writer_debug = new StreamWriter(debug_txt, false, enc_debug);
848 | writer_debug.WriteLine(input_image);
849 | writer_debug.WriteLine("mag_value " + mag_value.ToString());
850 | writer_debug.WriteLine("mag_mode_local " + mag_mode_local);
851 | writer_debug.WriteLine("Magick_resize_option " + Magick_resize_option);
852 | writer_debug.WriteLine("param_outformat " + param_outformat);
853 | writer_debug.WriteLine("param_output_quality " + param_output_quality);
854 | writer_debug.WriteLine("txtScale_ratio_exponent " + txtScale_ratio_exponent.ToString());
855 | writer_debug.WriteLine("scale_ratio_public " + scale_ratio_public.ToString());
856 | writer_debug.WriteLine("scale_ratio_local " + scale_ratio_local.ToString());
857 | writer_debug.WriteLine("Image_Width " + Image_Width);
858 | writer_debug.WriteLine("Image_Height " + Image_Height);
859 | writer_debug.WriteLine("output_width_public " + output_width_public.ToString());
860 | writer_debug.WriteLine("output_height_public " + output_height_public);
861 | writer_debug.WriteLine("output_width_local " + output_width_local.ToString());
862 | writer_debug.WriteLine("output_height_local " + output_height_local.ToString());
863 | writer_debug.WriteLine("binary_type " + binary_type.ToString());
864 | writer_debug.Close();
865 |
866 | */
867 |
868 | if (AlphaHas == true)
869 | {
870 | startInfo.Arguments =
871 | "/C .\\ImageMagick\\magick.exe convert \"" + input_image + "\" -channel RGB -separate -combine png24:\"" + System.IO.Path.GetTempPath() + random32 + "-RGB" + r2 + "x.png" + "\" && " +
872 | ".\\ImageMagick\\magick.exe convert \"" + input_image + "\" -channel matte -separate +matte png24:\"" + System.IO.Path.GetTempPath() + random32 + "-Alpha" + r2 + "x.png" + "\""
873 | ;
874 | process.StartInfo = startInfo;
875 | process.Start();
876 | process.WaitForExit();
877 | }
878 | for (; run_times <= 10; run_times = run_times + 1)
879 | {
880 | if (Cancel == true) return;
881 | output_temp = System.IO.Path.GetTempPath() + random32 + "-" + r + "x.png";
882 | output_rgb_temp = System.IO.Path.GetTempPath() + random32 + "-RGB" + r + "x.png";
883 | output_alpha_temp = System.IO.Path.GetTempPath() + random32 + "-Alpha" + r + "x.png";
884 | input_temp = System.IO.Path.GetTempPath() + random32 + "-" + r2 + "x.png";
885 | input_rgb_temp = System.IO.Path.GetTempPath() + random32 + "-RGB" + r2 + "x.png";
886 | input_alpha_temp = System.IO.Path.GetTempPath() + random32 + "-Alpha" + r2 + "x.png";
887 | if (run_times == 1)
888 | {
889 | if (AlphaHas == true)
890 | {
891 | if (scale_ratio_local == 1)
892 | {
893 | startInfo.Arguments = "/C " + binary_path + " -i \"" + input_rgb_temp + "\" -o \"" + output_rgb_temp + "\" -s " + mag_value + " " + noise_level_temp + " " + others_param;
894 | }
895 | else
896 | {
897 | startInfo.Arguments = "/C " + binary_path + " -i \"" + input_rgb_temp + "\" -o \"" + output_rgb_temp + "\" -s " + mag_value + " " + noise_level_temp + " " + others_param + "&& " +
898 | binary_path + " -i \"" + input_alpha_temp + "\" -o \"" + output_alpha_temp + "\" -s " + mag_value + " " + noise_level_temp2 + " " + others_param;
899 | }
900 | }
901 | else
902 | {
903 | startInfo.Arguments = "/C " + binary_path + " -i \"" + input_image + "\" -o \"" + output_temp + "\" -s " + mag_value + " " + noise_level_temp + " " + others_param;
904 | }
905 | }
906 | else
907 | {
908 | if (AlphaHas == true)
909 | {
910 | startInfo.Arguments = "/C " + binary_path + " -i \"" + input_rgb_temp + "\" -o \"" + output_rgb_temp + "\" -s " + mag_value + " " + noise_level_temp2 + " " + others_param + "&& " +
911 | binary_path + " -i \"" + input_alpha_temp + "\" -o \"" + output_alpha_temp + "\" -s " + mag_value + " " + noise_level_temp2 + " " + others_param;
912 | }
913 | else
914 | {
915 | startInfo.Arguments = "/C " + binary_path + " -i \"" + input_temp + "\" -o \"" + output_temp + "\" -s " + mag_value + " " + noise_level_temp2 + " " + others_param;
916 | }
917 |
918 | }
919 |
920 |
921 | process.StartInfo = startInfo;
922 | process.Start();
923 | string stdout = process.StandardOutput.ReadToEnd() + process.StandardError.ReadToEnd();
924 | process.WaitForExit();
925 | if (process.ExitCode != 0) if (Cancel == false)
926 | {
927 | System.Media.SystemSounds.Beep.Play();
928 | CLIOutput.Dispatcher.Invoke(() => CLIOutput.Focus(), DispatcherPriority.Background);
929 | CLIOutput.Dispatcher.Invoke(() => this.CLIOutput.AppendText("Error: The process failed and will be retried.\ncmd.exe " + startInfo.Arguments + "\n" + stdout + "\n"), DispatcherPriority.Background);
930 | CLIOutput.Dispatcher.Invoke(() => CLIOutput.Select(CLIOutput.Text.Length, 0), DispatcherPriority.Background);
931 | }
932 | if (scale_ratio_local != 1)
933 | {
934 | new FileInfo(input_temp).Delete();
935 | new FileInfo(input_rgb_temp).Delete();
936 | new FileInfo(input_alpha_temp).Delete();
937 | }
938 | if (r >= scale_ratio_local) break;
939 | if (mag_value == "4") r2 = r2 * 4;
940 | if (mag_value == "2") r2 = r2 * 2;
941 | if (binary_type.ToString() == "realsr")
942 | {
943 | mag_value = "4";
944 | r = r * 4;
945 | }
946 | else if (binary_type.ToString() == "realesrgan")
947 | {
948 | if (param_model2.ToString().Replace("-n ", "") == "realesr-animevideov3" && r * 2 >= scale_ratio_local)
949 | {
950 | mag_value = "2";
951 | r = r * 2;
952 | }
953 | else
954 | {
955 | mag_value = "4";
956 | r = r * 4;
957 | }
958 | }
959 | else if (binary_type.ToString() == "realcugan")
960 | {
961 | if (param_model2.ToString().Replace("-m ", "") == "models-se" && noise_level_temp != "-n 1" && noise_level_temp != "-n 2" && r * 4 <= scale_ratio_local)
962 | {
963 | mag_value = "4";
964 | r = r * 4;
965 | }
966 | else
967 | {
968 | mag_value = "2";
969 | r = r * 2;
970 | }
971 | }
972 | else
973 | {
974 | mag_value = "2";
975 | r = r * 2;
976 | }
977 | }
978 | if (AlphaHas == true)
979 | {
980 | startInfo.Arguments = "/C .\\ImageMagick\\magick.exe convert " + "\"" + output_rgb_temp + "\" " + "\"" + output_alpha_temp + "\" -compose CopyOpacity -composite " + param_output_quality + Magick_resize_option + " \"" + output_final + "\"";
981 | process.StartInfo = startInfo;
982 | process.Start();
983 | process.WaitForExit();
984 | new FileInfo(output_rgb_temp).Delete();
985 | new FileInfo(output_alpha_temp).Delete();
986 | }
987 | else
988 | {
989 | if (Cancel == true) return;
990 | if (param_outformat.ToString() == "png" && Magick_resize_option.Trim() == "")
991 | {
992 | try
993 | {
994 | if (File.Exists(output_final))
995 | {
996 | File.Delete(output_final);
997 | }
998 | System.IO.File.Move(output_temp, output_final);
999 | }
1000 | catch
1001 | { }
1002 | }
1003 | else
1004 | {
1005 | startInfo.Arguments = "/C .\\ImageMagick\\magick.exe convert " + "\"" + output_temp + "\" " + param_output_quality + Magick_resize_option + " \"" + output_final + "\"";
1006 | process.StartInfo = startInfo;
1007 | process.Start();
1008 | process.WaitForExit();
1009 | new FileInfo(output_temp).Delete();
1010 | }
1011 |
1012 | }
1013 | if (!File.Exists(output_final))
1014 | {
1015 | if (retryCount == 5)
1016 | {
1017 | System.Media.SystemSounds.Beep.Play();
1018 | CLIOutput.Dispatcher.Invoke(() => CLIOutput.Focus(), DispatcherPriority.Background);
1019 | CLIOutput.Dispatcher.Invoke(() => this.CLIOutput.AppendText("Error: Output file could not be found.\ninput " + input_image + "\noutput " + output_final + "\n\n"), DispatcherPriority.Background);
1020 | CLIOutput.Dispatcher.Invoke(() => CLIOutput.Select(CLIOutput.Text.Length, 0), DispatcherPriority.Background);
1021 | try
1022 | {
1023 | Encoding enc = Encoding.UTF8;
1024 | StreamWriter writer = new StreamWriter("error_log.txt", true, enc);
1025 | writer.WriteLine(System.DateTime.Now.ToString());
1026 | writer.WriteLine("Error: Output file could not be found.");
1027 | writer.WriteLine("input " + input_image);
1028 | writer.WriteLine("output " + output_final + "\r\n");
1029 | writer.Close();
1030 | }
1031 | catch
1032 | { }
1033 | }
1034 | }
1035 | else
1036 | {
1037 | break;
1038 | }
1039 | }
1040 | }
1041 | public void Errormessage(string x)
1042 | {
1043 | System.Media.SystemSounds.Beep.Play();
1044 | MessageBox.Show(@x);
1045 | btnAbort.IsEnabled = false;
1046 | btnRun.IsEnabled = true;
1047 | return;
1048 | }
1049 |
1050 | async private void OnRun(object sender, RoutedEventArgs e)
1051 | {
1052 | Cancel = false;
1053 | binary_path.Clear();
1054 | binary_type.Clear();
1055 | if (param_model.ToString().Replace("-m ", "") == "models-DF2K" || param_model.ToString().Replace("-m ", "") == "models-DF2K_JPEG")
1056 | {
1057 | if (!File.Exists("realsr-ncnn-vulkan\\realsr-ncnn-vulkan.exe"))
1058 | {
1059 | MessageBox.Show(@"realsr-ncnn-vulkan\\realsr-ncnn-vulkan.exe is missing!");
1060 | return;
1061 | }
1062 | binary_path.Append(".\\realsr-ncnn-vulkan\\realsr-ncnn-vulkan.exe ");
1063 | binary_type.Append("realsr");
1064 | }
1065 | else if (param_model.ToString().Replace("-n ", "") == "realesrgan-x4plus" || param_model.ToString().Replace("-n ", "") == "realesrnet-x4plus" || param_model.ToString().Replace("-n ", "") == "realesrgan-x4plus-anime" || param_model.ToString().Replace("-n ", "") == "realesr-animevideov3")
1066 | {
1067 | if (!File.Exists("realesrgan-ncnn-vulkan\\realesrgan-ncnn-vulkan.exe"))
1068 | {
1069 | MessageBox.Show(@"realesrgan-ncnn-vulkan\\realesrgan-ncnn-vulkan.exe is missing!");
1070 | return;
1071 | }
1072 | binary_path.Append(".\\realesrgan-ncnn-vulkan\\realesrgan-ncnn-vulkan.exe ");
1073 | binary_type.Append("realesrgan");
1074 | }
1075 | else if (param_model.ToString().Replace("-m ", "") == "models-se" || param_model.ToString().Replace("-m ", "") == "models-pro")
1076 | {
1077 | if (!File.Exists("realcugan-ncnn-vulkan\\realcugan-ncnn-vulkan.exe"))
1078 | {
1079 | MessageBox.Show(@"realcugan-ncnn-vulkan\\realcugan-ncnn-vulkan.exe is missing!");
1080 | return;
1081 | }
1082 | binary_path.Append(".\\realcugan-ncnn-vulkan\\realcugan-ncnn-vulkan.exe ");
1083 | binary_type.Append("realcugan");
1084 | }
1085 | else
1086 | {
1087 | binary_type.Append("waifu2x");
1088 | if (checkPrecision_fp32.IsChecked == true)
1089 | {
1090 | if (!File.Exists("waifu2x-ncnn-vulkan\\waifu2x-ncnn-vulkan-fp32.exe"))
1091 | {
1092 | MessageBox.Show(@"waifu2x-ncnn-vulkan\\waifu2x-ncnn-vulkan-fp32.exe is missing!");
1093 | return;
1094 | }
1095 | binary_path.Append(".\\waifu2x-ncnn-vulkan\\waifu2x-ncnn-vulkan-fp32.exe ");
1096 | }
1097 | else
1098 | {
1099 | if (!File.Exists("waifu2x-ncnn-vulkan\\waifu2x-ncnn-vulkan.exe"))
1100 | {
1101 | MessageBox.Show(@"waifu2x-ncnn-vulkan\\waifu2x-ncnn-vulkan.exe is missing!");
1102 | return;
1103 | }
1104 | binary_path.Append(".\\waifu2x-ncnn-vulkan\\waifu2x-ncnn-vulkan.exe ");
1105 | }
1106 | }
1107 |
1108 | if (!File.Exists("ImageMagick\\Magick.exe"))
1109 | {
1110 | MessageBox.Show(@"ImageMagick is missing!");
1111 | return;
1112 | }
1113 |
1114 | if (param_src == null)
1115 | {
1116 | MessageBox.Show(@"source images is not found!");
1117 | return;
1118 | }
1119 |
1120 | if (this.txtDstPath.Text.Trim() != "") if (!Directory.Exists(this.txtDstPath.Text))
1121 | {
1122 | try
1123 | {
1124 | Directory.CreateDirectory(this.txtDstPath.Text);
1125 | }
1126 | catch
1127 | {
1128 | MessageBox.Show(@"Failed to create folder!");
1129 | return;
1130 | }
1131 | }
1132 |
1133 | // Sets Source
1134 | // The source must be a file or folder that exists
1135 |
1136 | param_tta.Clear();
1137 | if (checkTTAmode.IsChecked == true)
1138 | {
1139 | param_tta.Append("-x");
1140 | }
1141 |
1142 | if (System.Text.RegularExpressions.Regex.IsMatch(
1143 | txtGPU_ID.Text,
1144 | @"^(\d+)$",
1145 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1146 | {
1147 | param_gpu_id.Clear();
1148 | param_gpu_id.Append("-g ");
1149 | param_gpu_id.Append(txtGPU_ID.Text);
1150 | }
1151 | else
1152 | {
1153 | param_gpu_id.Clear();
1154 | }
1155 |
1156 | if (System.Text.RegularExpressions.Regex.IsMatch(
1157 | txtBlocksize.Text,
1158 | @"^(\d+)$",
1159 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1160 | {
1161 | if (int.Parse(txtBlocksize.Text) % 4 != 0)
1162 | {
1163 | MessageBox.Show(@"Block size must be a multiple of 4");
1164 | return;
1165 | }
1166 | else
1167 | {
1168 | param_block.Clear();
1169 | param_block.Append("-t ");
1170 | param_block.Append(txtBlocksize.Text);
1171 | }
1172 | }
1173 | else
1174 | {
1175 | param_block.Clear();
1176 | }
1177 |
1178 | param_outformat.Clear();
1179 | param_outformat.Append(txtOutExt.Text);
1180 |
1181 | param_output_quality.Clear();
1182 | if (!System.Text.RegularExpressions.Regex.IsMatch(
1183 | txtOutQuality.Text,
1184 | @"^(\d+)$",
1185 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1186 | {
1187 | txtOutQuality.Text = "100";
1188 | }
1189 | if (param_outformat.ToString() == "webp")
1190 | {
1191 | if (txtOutQuality.Text == "100")
1192 | {
1193 | param_output_quality.Append("-define webp:lossless=true");
1194 | }
1195 | else
1196 | {
1197 | param_output_quality.Append("-quality " + txtOutQuality.Text);
1198 | }
1199 | }
1200 | else if (param_outformat.ToString() == "jpg")
1201 | {
1202 | param_output_quality.Append("( +clone -alpha opaque -fill white -colorize 100% ) +swap -geometry +0+0 -compose Over -composite -alpha off -quality " + txtOutQuality.Text);
1203 | }
1204 | else
1205 | {
1206 | param_output_quality.Append("-quality " + txtOutQuality.Text);
1207 | }
1208 |
1209 | /*
1210 | if (((int.Parse(txtScale_ratio.Text) & int.Parse(txtScale_ratio.Text) - 1)) != 0)
1211 | {
1212 | MessageBox.Show(@"Magnification must be a power of two.");
1213 | return;
1214 | }
1215 | */
1216 | param_mode2.Clear();
1217 | param_mode2.Append(param_mode.ToString());
1218 | if (param_mode2.ToString() == "noise") if (param_model.ToString().Replace("-m ", "") != "models-cunet")
1219 | {
1220 | MessageBox.Show("\"Denoise only\" is available only for CUnet models.");
1221 | return;
1222 | }
1223 |
1224 | if (System.Text.RegularExpressions.Regex.IsMatch(
1225 | txtThread.Text,
1226 | @"^(\d+)$",
1227 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1228 | {
1229 | param_thread.Clear();
1230 | param_thread.Append(txtThread.Text);
1231 | }
1232 | else
1233 | {
1234 | param_thread.Clear();
1235 | }
1236 |
1237 | param_model2.Clear();
1238 | param_model2.Append(param_model.ToString());
1239 |
1240 | param_denoise2.Clear();
1241 | param_denoise2.Append("-n ");
1242 | param_denoise2.Append(param_denoise.ToString());
1243 | output_width_public = 0;
1244 | output_height_public = 0;
1245 | // Set mode
1246 |
1247 | if (param_mode2.ToString() == "scale")
1248 | {
1249 | param_denoise2.Clear();
1250 | param_denoise2.Append("-n ");
1251 | param_denoise2.Append("-1");
1252 | }
1253 |
1254 | if (System.Text.RegularExpressions.Regex.IsMatch(
1255 | txtScale_ratio.Text,
1256 | @"^(\d+(\.\d+)?)$",
1257 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1258 | {
1259 | scale_ratio_public = float.Parse(txtScale_ratio.Text);
1260 | }
1261 | else
1262 | {
1263 | MessageBox.Show("Scale_ratio must be a number.");
1264 | return;
1265 | }
1266 |
1267 | txtScale_ratio_exponent = false;
1268 | if (binary_type.ToString() != "realesrgan" && System.Text.RegularExpressions.Regex.IsMatch(
1269 | txtScale_ratio.Text,
1270 | @"^(2|4|8|16|32|64|128|256|512|1024)$",
1271 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1272 | {
1273 | txtScale_ratio_exponent = true;
1274 | }
1275 | if (binary_type.ToString() == "realesrgan" && System.Text.RegularExpressions.Regex.IsMatch(
1276 | txtScale_ratio.Text,
1277 | @"^(4|16|64|128|512)$",
1278 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1279 | {
1280 | txtScale_ratio_exponent = true;
1281 | }
1282 |
1283 | if (param_mode2.ToString() != "noise") if (param_mag_mode.ToString() == "Width_mode") if (System.Text.RegularExpressions.Regex.IsMatch(
1284 | txtOutput_width.Text,
1285 | @"^(\d+)$",
1286 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1287 | {
1288 | output_width_public = int.Parse(txtOutput_width.Text);
1289 | }
1290 | else
1291 | {
1292 | MessageBox.Show("Width must be a number.");
1293 | return;
1294 | }
1295 |
1296 | if (param_mode2.ToString() != "noise") if (param_mag_mode.ToString() == "Height_mode") if (System.Text.RegularExpressions.Regex.IsMatch(
1297 | txtOutput_height.Text,
1298 | @"^(\d+)$",
1299 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1300 | {
1301 | output_height_public = int.Parse(txtOutput_height.Text);
1302 | }
1303 | else
1304 | {
1305 | MessageBox.Show("Height must be a number.");
1306 | return;
1307 | }
1308 |
1309 | if (param_mode2.ToString() != "noise") if (param_mag_mode.ToString() == "Width_height_mode") if (System.Text.RegularExpressions.Regex.IsMatch(
1310 | txtOutput_width_height.Text,
1311 | @"^(\d+x\d+)$",
1312 | System.Text.RegularExpressions.RegexOptions.ECMAScript))
1313 | {
1314 | string[] width_height = txtOutput_width_height.Text.Split('x');
1315 | output_width_public = int.Parse(width_height[0]);
1316 | output_height_public = int.Parse(width_height[1]);
1317 | }
1318 | else
1319 | {
1320 | MessageBox.Show("Width and Height must be a number.\n\nexample: 1920x1080");
1321 | return;
1322 | }
1323 |
1324 | this.btnRun.IsEnabled = false;
1325 | this.btnAbort.IsEnabled = true;
1326 |
1327 | param_dst.Clear();
1328 | param_dst.Append(this.txtDstPath.Text);
1329 |
1330 | param_dst_suffix.Clear();
1331 | if (this.txtDstPath.Text.Trim() == "")
1332 | {
1333 | if (param_model.ToString().Replace("-m ", "") == "models-cunet")
1334 | { param_dst_suffix.Append("(CUnet)"); }
1335 | if (param_model.ToString().Replace("-m ", "") == "models-upconv_7_anime_style_art_rgb")
1336 | { param_dst_suffix.Append("(UpRGB)"); }
1337 | if (param_model.ToString().Replace("-m ", "") == "models-upconv_7_photo")
1338 | { param_dst_suffix.Append("(UpPhoto)"); }
1339 | if (param_model.ToString().Replace("-m ", "") == "models-se")
1340 | { param_dst_suffix.Append("(Real-CUGAN-se)"); }
1341 | if (param_model.ToString().Replace("-m ", "") == "models-pro")
1342 | { param_dst_suffix.Append("(Real-CUGAN-pro)"); }
1343 | if (param_model.ToString().Replace("-n ", "") == "realesrgan-x4plus")
1344 | { param_dst_suffix.Append("(realesrgan-x4plus)"); }
1345 | if (param_model.ToString().Replace("-n ", "") == "realesrnet-x4plus")
1346 | { param_dst_suffix.Append("(realesrnet-x4plus)"); }
1347 | if (param_model.ToString().Replace("-n ", "") == "realesrgan-x4plus-anime")
1348 | { param_dst_suffix.Append("(realesrgan-x4plus-anime)"); }
1349 | if (param_model.ToString().Replace("-n ", "") == "realesr-animevideov3")
1350 | { param_dst_suffix.Append("(realesr-animevideov3)"); }
1351 | if (param_model.ToString().Replace("-m ", "") == "models-DF2K")
1352 | { param_dst_suffix.Append("(DF2K)"); }
1353 | if (param_model.ToString().Replace("-m ", "") == "models-DF2K_JPEG")
1354 | { param_dst_suffix.Append("(DF2K_JPEG)"); }
1355 | param_dst_suffix.Append("(");
1356 | param_dst_suffix.Append(param_mode2.ToString().Replace("-m ", ""));
1357 | param_dst_suffix.Append(")");
1358 | if (param_mode2.ToString() == "noise" || param_mode2.ToString() == "noise_scale" || param_mode2.ToString() == "auto_scale")
1359 | {
1360 | param_dst_suffix.Append("(");
1361 | param_dst_suffix.Append("Level");
1362 | param_dst_suffix.Append(param_denoise.ToString());
1363 | param_dst_suffix.Append(")");
1364 | }
1365 | if (checkTTAmode.IsChecked == true)
1366 | {
1367 | param_dst_suffix.Append("(tta)");
1368 | }
1369 |
1370 | if (param_mode2.ToString() == "scale" || param_mode2.ToString() == "noise_scale" || param_mode2.ToString() == "auto_scale")
1371 | {
1372 | if (param_mag_mode.ToString() == "Scale_ratio_mode")
1373 | {
1374 | param_dst_suffix.Append("(x");
1375 | param_dst_suffix.Append(txtScale_ratio.Text);
1376 | param_dst_suffix.Append(")");
1377 | }
1378 | if (param_mag_mode.ToString() == "Width_mode")
1379 | {
1380 | param_dst_suffix.Append("(width ");
1381 | param_dst_suffix.Append(output_width_public);
1382 | param_dst_suffix.Append(")");
1383 | }
1384 | if (param_mag_mode.ToString() == "Height_mode")
1385 | {
1386 | param_dst_suffix.Append("(height ");
1387 | param_dst_suffix.Append(output_height_public);
1388 | param_dst_suffix.Append(")");
1389 | }
1390 | if (param_mag_mode.ToString() == "Width_height_mode")
1391 | {
1392 | param_dst_suffix.Append("(");
1393 | if (checkKeep_aspect_ratio.IsChecked == true)
1394 | {
1395 | param_dst_suffix.Append("within ");
1396 | }
1397 | param_dst_suffix.Append(output_width_public);
1398 | param_dst_suffix.Append("x");
1399 | param_dst_suffix.Append(output_height_public);
1400 | param_dst_suffix.Append(")");
1401 | }
1402 |
1403 | }
1404 | if (binary_type.ToString() == "waifu2x" && checkPrecision_fp32.IsChecked == true)
1405 | {
1406 | param_dst_suffix.Append("(FP32)");
1407 | }
1408 | }
1409 | Keep_aspect_ratio = checkKeep_aspect_ratio.IsChecked.Value;
1410 | Output_no_overwirit = checkOutput_no_overwirit.IsChecked.Value;
1411 | Alphachannel_ImageMagick = checkAlphachannel_ImageMagick.IsChecked.Value;
1412 | if (param_mode2.ToString() == "noise")
1413 | { scale_ratio_public = 1; }
1414 |
1415 | FileCount = 0;
1416 | var reg = new Regex(@".+\.(jpe?g|png|bmp|gif|tiff?|webp)$", RegexOptions.IgnoreCase);
1417 | foreach (var dropfile in param_src)
1418 | {
1419 | if (File.Exists(dropfile))
1420 | {
1421 | FileCount += 1;
1422 | }
1423 | if (Directory.Exists(dropfile))
1424 | {
1425 | await Task.Run(() =>
1426 | {
1427 | var Directoryfiles = Directory.GetFiles((dropfile), "*", SearchOption.AllDirectories).Where(f => reg.IsMatch(f)).ToArray();
1428 | foreach (var Directoryimage in Directoryfiles)
1429 | {
1430 | FileCount += 1;
1431 | }
1432 | });
1433 | }
1434 | }
1435 |
1436 | prgbar.Maximum = FileCount;
1437 | prgbar.Value = 0;
1438 | this.CLIOutput.Clear();
1439 |
1440 | await Task.Run(() => tasks_waifu2x(int.Parse(param_thread.ToString()), FileCount, param_mag_mode.ToString(), param_mode2.ToString()));
1441 | TimeSpan Processing_time;
1442 | Processing_time = DateTime.Now - starttimea;
1443 | while (true)
1444 | {
1445 | await Task.Delay(100);
1446 | if (prgbar.Value == FileCount)
1447 | {
1448 | pLabel.Dispatcher.Invoke(() => pLabel.Content = "Processing time: " + (Processing_time).ToString(@"hh\:mm\:ss\.fff"), DispatcherPriority.Background);
1449 | break;
1450 | }
1451 | if (Cancel == true)
1452 | {
1453 | pLabel.Dispatcher.Invoke(() => pLabel.Content = "has cancelled", DispatcherPriority.Background);
1454 | break;
1455 | }
1456 | }
1457 | prgbar.Value = 0;
1458 | this.btnRun.IsEnabled = true;
1459 | this.btnAbort.IsEnabled = false;
1460 |
1461 | if (checkSoundBeep.IsChecked == true)
1462 | { System.Media.SystemSounds.Beep.Play(); }
1463 | }
1464 |
1465 |
1466 | }
1467 | }
1468 |
--------------------------------------------------------------------------------