├── .gitignore ├── LICENSE ├── README.md ├── _config.yml ├── img ├── 1.jpg ├── 1.png ├── Ai-Image-Zoom.png ├── ai-image-zoom-about.png ├── ai-image-zoom-settings.png ├── ai-image-zoom-ui.png └── face.png └── src ├── AiZoom.sln └── AiZoom ├── AiZoom.csproj ├── App.config ├── App.xaml ├── App.xaml.cs ├── AssemblyInfo.cs ├── Data └── Locale.json ├── FodyWeavers.xml ├── FodyWeavers.xsd ├── Images ├── icon.ico └── icon.png ├── Locator.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Models ├── LocaleModel.cs └── SettingModel.cs ├── NLog.config ├── Resources ├── Localize.Designer.cs ├── Localize.resx └── Localize.zh-Hant.resx ├── Services ├── Interfaces │ ├── ILocaleService.cs │ └── IModuleService.cs ├── LocaleService.cs └── ModuleService.cs ├── View ├── AboutView.xaml ├── AboutView.xaml.cs ├── HomeView.xaml ├── HomeView.xaml.cs ├── SettingView.xaml └── SettingView.xaml.cs ├── ViewModel ├── AboutViewModel.cs ├── HomeViewModel.cs ├── MainViewModel.cs.cs └── SettingViewModel.cs ├── config.ini └── icon.ico /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 2 | [![AI Image Zoom](img/Ai-Image-Zoom.png)](https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/main/img/Ai-Image-Zoom.png) 3 | 4 | # AI Image Zoom 5 | 6 | AI Image Zoom using the Real-ESRGAN AI engine with pre-trained models to upscale and enhance images without losing quality. This little tool can restore your photos and bring life to them again. 7 | 8 | ### Features 9 | - Increase image resolution 10 | - Remove noise/artifact 11 | - Add details to your image 12 | - Support JPG, PNG, and WEBP format 13 | 14 | ### End Result 15 | The result is amazing.
Original (left image) - Upscaled (right image) 16 | ![](img/1.png) 17 | ![](img/face.png) 18 | 19 | # Application UI 20 | ![](img/ai-image-zoom-ui.png) 21 | ![](img/ai-image-zoom-settings.png) 22 | ![](img/ai-image-zoom-about.png) 23 | 24 | # Download 25 | https://github.com/jedipi/AI-Image-Zoom/releases 26 | 27 | 28 | # System Requirement 29 | - Windows 7+ 30 | - .net 5 31 | - GPU 32 | 33 | # Related Project 34 | Real-ESRGAN: https://github.com/xinntao/Real-ESRGAN 35 | 36 | 37 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | -------------------------------------------------------------------------------- /img/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/img/1.jpg -------------------------------------------------------------------------------- /img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/img/1.png -------------------------------------------------------------------------------- /img/Ai-Image-Zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/img/Ai-Image-Zoom.png -------------------------------------------------------------------------------- /img/ai-image-zoom-about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/img/ai-image-zoom-about.png -------------------------------------------------------------------------------- /img/ai-image-zoom-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/img/ai-image-zoom-settings.png -------------------------------------------------------------------------------- /img/ai-image-zoom-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/img/ai-image-zoom-ui.png -------------------------------------------------------------------------------- /img/face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/img/face.png -------------------------------------------------------------------------------- /src/AiZoom.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31613.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AiZoom", "AiZoom\AiZoom.csproj", "{192D7A36-3F07-41DD-9E2B-084A94DAEBD6}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "readme", "readme", "{5D30D159-DAFB-406F-9D38-98892A006300}" 9 | ProjectSection(SolutionItems) = preProject 10 | ..\README.md = ..\README.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {192D7A36-3F07-41DD-9E2B-084A94DAEBD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {192D7A36-3F07-41DD-9E2B-084A94DAEBD6}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {192D7A36-3F07-41DD-9E2B-084A94DAEBD6}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {192D7A36-3F07-41DD-9E2B-084A94DAEBD6}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | GlobalSection(ExtensibilityGlobals) = postSolution 28 | SolutionGuid = {0FC31DCD-D952-4252-A73C-D8293419FEBA} 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /src/AiZoom/AiZoom.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 2.0.0 8 | icon.ico 9 | 10 | icon.png 11 | 12 | 2.0.0.0 13 | 2.0.0.0 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | True 38 | True 39 | Localize.resx 40 | 41 | 42 | 43 | 44 | 45 | ResXFileCodeGenerator 46 | Localize.Designer.cs 47 | 48 | 49 | 50 | 51 | 52 | PreserveNewest 53 | 54 | 55 | Always 56 | 57 | 58 | PreserveNewest 59 | 60 | 61 | Always 62 | 63 | 64 | True 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/AiZoom/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/AiZoom/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/AiZoom/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Globalization; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | using System.Windows; 11 | using AiZoom.Models; 12 | using NLog.Fluent; 13 | using TG.INI; 14 | using TG.INI.Serialization; 15 | using WPFLocalizeExtension.Engine; 16 | 17 | namespace AiZoom 18 | { 19 | /// 20 | /// Interaction logic for App.xaml 21 | /// 22 | public partial class App : Application 23 | { 24 | 25 | public App() 26 | { 27 | Initialise(); 28 | } 29 | 30 | public void Initialise() 31 | { 32 | var locale = "en"; 33 | if (File.Exists(@"config.ini")) 34 | { 35 | var document = new IniDocument(@"config.ini"); 36 | var settings = IniSerialization.DeserializeDocument(document); 37 | 38 | if (!string.IsNullOrEmpty(settings.Locale)) 39 | locale = settings.Locale; 40 | } 41 | LocalizeDictionary.Instance.Culture = new CultureInfo(locale); 42 | Thread.CurrentThread.CurrentCulture = new CultureInfo(locale); 43 | } 44 | 45 | private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) 46 | { 47 | var ex = new Exception("System has detected an uncaught exception, see inner exception.", e.Exception); 48 | Log.Fatal().Message(ex.Message).Exception(ex).Write(); 49 | MessageBox.Show(ex.ToString(), "Uncaught Exception"); 50 | } 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/AiZoom/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /src/AiZoom/Data/Locale.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Code": "en", 4 | "Name": "English" 5 | }, 6 | { 7 | "Code": "zh-Hant", 8 | "Name": "中文" 9 | } 10 | ] 11 | 12 | -------------------------------------------------------------------------------- /src/AiZoom/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /src/AiZoom/FodyWeavers.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Used to control if the On_PropertyName_Changed feature is enabled. 12 | 13 | 14 | 15 | 16 | Used to control if the Dependent properties feature is enabled. 17 | 18 | 19 | 20 | 21 | Used to control if the IsChanged property feature is enabled. 22 | 23 | 24 | 25 | 26 | Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. 27 | 28 | 29 | 30 | 31 | Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project. 32 | 33 | 34 | 35 | 36 | Used to control if equality checks should use the Equals method resolved from the base class. 37 | 38 | 39 | 40 | 41 | Used to control if equality checks should use the static Equals method resolved from the base class. 42 | 43 | 44 | 45 | 46 | Used to turn off build warnings from this weaver. 47 | 48 | 49 | 50 | 51 | Used to turn off build warnings about mismatched On_PropertyName_Changed methods. 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. 60 | 61 | 62 | 63 | 64 | A comma-separated list of error codes that can be safely ignored in assembly verification. 65 | 66 | 67 | 68 | 69 | 'false' to turn off automatic generation of the XML Schema file. 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/AiZoom/Images/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/src/AiZoom/Images/icon.ico -------------------------------------------------------------------------------- /src/AiZoom/Images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/src/AiZoom/Images/icon.png -------------------------------------------------------------------------------- /src/AiZoom/Locator.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Autofac; 3 | using MahApps.Metro.Controls.Dialogs; 4 | 5 | namespace AiZoom 6 | { 7 | public static class Locator 8 | { 9 | public static IContainer Container { get; } 10 | 11 | static Locator() 12 | { 13 | ContainerBuilder builder = new ContainerBuilder(); 14 | RegisterType(builder); 15 | Container = builder.Build(); 16 | } 17 | 18 | /// 19 | /// register all viewmodels, services, and repositories 20 | /// 21 | /// 22 | static void RegisterType(ContainerBuilder builder) 23 | { 24 | var app = Assembly.GetAssembly(typeof(App)); 25 | 26 | // register all ViewModels 27 | builder.RegisterAssemblyTypes(app) 28 | .Where(t => t.Name.EndsWith("ViewModel")); 29 | 30 | // register all services 31 | builder.RegisterAssemblyTypes(app) 32 | .Where(t => t.Name.EndsWith("Service")) 33 | .AsImplementedInterfaces(); 34 | 35 | 36 | // register special one 37 | builder.RegisterInstance(DialogCoordinator.Instance).As().SingleInstance(); 38 | 39 | 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/AiZoom/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 39 | 43 | 44 | 45 | 46 | 47 | 161 | 162 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 189 | 190 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /src/AiZoom/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | using Autofac; 17 | using MahApps.Metro.Controls; 18 | using AiZoom.ViewModel; 19 | using CliWrap; 20 | 21 | namespace AiZoom 22 | { 23 | /// 24 | /// Interaction logic for MainWindow.xaml 25 | /// 26 | public partial class MainWindow : MetroWindow 27 | { 28 | public MainWindow() 29 | { 30 | InitializeComponent(); 31 | DataContext = Locator.Container.Resolve(); 32 | } 33 | 34 | private void HamburgerMenuControl_OnItemInvoked(object sender, HamburgerMenuItemInvokedEventArgs e) 35 | { 36 | this.HamburgerMenuControl.Content = e.InvokedItem; 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/AiZoom/Models/LocaleModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AiZoom.Data 8 | { 9 | public record LocaleModel 10 | { 11 | public string Code { get; set; } 12 | public string Name { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/AiZoom/Models/SettingModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AiZoom.Models 8 | { 9 | public class SettingModel 10 | { 11 | public string Locale { get; set; } 12 | public string Module { get; set; } 13 | public string FileNameSuffix { get; set; } 14 | public string OutputFormat { get; set; } 15 | public string OutputDirectory { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AiZoom/NLog.config: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | 10 | 13 | 14 | 15 | 19 | 20 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/AiZoom/Resources/Localize.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace AiZoom.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Localize { 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 Localize() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 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("AiZoom.Resources.Localize", typeof(Localize).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 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 | /// Looks up a localized string similar to Default Setting. 65 | /// 66 | internal static string ButtonDefault { 67 | get { 68 | return ResourceManager.GetString("ButtonDefault", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Discard Changes. 74 | /// 75 | internal static string ButtonDiscard { 76 | get { 77 | return ResourceManager.GetString("ButtonDiscard", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Save. 83 | /// 84 | internal static string ButtonSave { 85 | get { 86 | return ResourceManager.GetString("ButtonSave", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to Author - . 92 | /// 93 | internal static string LabelAuthor { 94 | get { 95 | return ResourceManager.GetString("LabelAuthor", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Engine:. 101 | /// 102 | internal static string LabelEngine { 103 | get { 104 | return ResourceManager.GetString("LabelEngine", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Output File Format:. 110 | /// 111 | internal static string LabelFileFormat { 112 | get { 113 | return ResourceManager.GetString("LabelFileFormat", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to File Name Suffix:. 119 | /// 120 | internal static string LabelFileSuffix { 121 | get { 122 | return ResourceManager.GetString("LabelFileSuffix", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to Display Language:. 128 | /// 129 | internal static string LabelLanguage { 130 | get { 131 | return ResourceManager.GetString("LabelLanguage", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to Trained Model:. 137 | /// 138 | internal static string LabelModel { 139 | get { 140 | return ResourceManager.GetString("LabelModel", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to Output Directory:. 146 | /// 147 | internal static string LabelOutputDirectory { 148 | get { 149 | return ResourceManager.GetString("LabelOutputDirectory", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Version - . 155 | /// 156 | internal static string LabelVersion { 157 | get { 158 | return ResourceManager.GetString("LabelVersion", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Website - . 164 | /// 165 | internal static string LabelWebsite { 166 | get { 167 | return ResourceManager.GetString("LabelWebsite", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to About. 173 | /// 174 | internal static string MenuAbout { 175 | get { 176 | return ResourceManager.GetString("MenuAbout", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// Looks up a localized string similar to Settings. 182 | /// 183 | internal static string MenuSettings { 184 | get { 185 | return ResourceManager.GetString("MenuSettings", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// Looks up a localized string similar to Zoom. 191 | /// 192 | internal static string MenuZoom { 193 | get { 194 | return ResourceManager.GetString("MenuZoom", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// Looks up a localized string similar to AI Image Zoom. 200 | /// 201 | internal static string Title { 202 | get { 203 | return ResourceManager.GetString("Title", resourceCulture); 204 | } 205 | } 206 | 207 | /// 208 | /// Looks up a localized string similar to About AI Image Zoom. 209 | /// 210 | internal static string TitleAbout { 211 | get { 212 | return ResourceManager.GetString("TitleAbout", resourceCulture); 213 | } 214 | } 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /src/AiZoom/Resources/Localize.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 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Default Setting 122 | 123 | 124 | Discard Changes 125 | 126 | 127 | Save 128 | 129 | 130 | Author - 131 | 132 | 133 | Engine: 134 | 135 | 136 | Output File Format: 137 | 138 | 139 | File Name Suffix: 140 | 141 | 142 | Display Language: 143 | 144 | 145 | Trained Model: 146 | 147 | 148 | Output Directory: 149 | 150 | 151 | Version - 152 | 153 | 154 | Website - 155 | 156 | 157 | About 158 | 159 | 160 | Settings 161 | 162 | 163 | Zoom 164 | 165 | 166 | AI Image Zoom 167 | 168 | 169 | About AI Image Zoom 170 | 171 | -------------------------------------------------------------------------------- /src/AiZoom/Resources/Localize.zh-Hant.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 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 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 | AI 放大 164 | 165 | 166 | AI 相片放大工具 167 | 168 | 169 | 關於 AI Image Zoom 170 | 171 | -------------------------------------------------------------------------------- /src/AiZoom/Services/Interfaces/ILocaleService.cs: -------------------------------------------------------------------------------- 1 | using AiZoom.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AiZoom.Services.Interfaces 9 | { 10 | public interface ILocaleService 11 | { 12 | List GetLocale(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/AiZoom/Services/Interfaces/IModuleService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AiZoom.Services.Interfaces 8 | { 9 | public interface IModuleService 10 | { 11 | List GetModules(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AiZoom/Services/LocaleService.cs: -------------------------------------------------------------------------------- 1 | using AiZoom.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Text.Json; 8 | using System.Text.Json.Serialization; 9 | using System.IO; 10 | using AiZoom.Services.Interfaces; 11 | 12 | namespace AiZoom.Services 13 | { 14 | public class LocaleService:ILocaleService 15 | { 16 | public List GetLocale() 17 | { 18 | var json = File.ReadAllText(@"Data\Locale.json"); 19 | var locales = JsonSerializer.Deserialize>(json); 20 | 21 | 22 | return locales; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/AiZoom/Services/ModuleService.cs: -------------------------------------------------------------------------------- 1 | using AiZoom.Services.Interfaces; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AiZoom.Services 10 | { 11 | public class ModuleService : IModuleService 12 | { 13 | public List GetModules() 14 | { 15 | List fileNames = new List(); 16 | var dir = new DirectoryInfo(@"realesrgan\models"); 17 | var files = dir.GetFiles("*.bin"); 18 | foreach (var f in files) 19 | { 20 | fileNames.Add(Path.GetFileNameWithoutExtension(f.Name)); 21 | } 22 | 23 | return fileNames; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/AiZoom/View/AboutView.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/AiZoom/View/AboutView.xaml.cs: -------------------------------------------------------------------------------- 1 | using AiZoom.ViewModel; 2 | using Autofac; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Data; 11 | using System.Windows.Documents; 12 | using System.Windows.Input; 13 | using System.Windows.Media; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Navigation; 16 | using System.Windows.Shapes; 17 | 18 | namespace AiZoom.View 19 | { 20 | /// 21 | /// Interaction logic for AboutView.xaml 22 | /// 23 | public partial class AboutView : UserControl 24 | { 25 | public AboutView() 26 | { 27 | InitializeComponent(); 28 | DataContext = Locator.Container.Resolve(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AiZoom/View/HomeView.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 64 | 65 | 66 | 73 | 74 | 81 | 82 | 83 | 84 | 79 | 80 | 81 | 82 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /src/AiZoom/View/SettingView.xaml.cs: -------------------------------------------------------------------------------- 1 | using AiZoom.ViewModel; 2 | using Autofac; 3 | using System.Windows.Controls; 4 | 5 | namespace AiZoom.View 6 | { 7 | /// 8 | /// Interaction logic for SettingView.xaml 9 | /// 10 | public partial class SettingView : UserControl 11 | { 12 | public SettingView() 13 | { 14 | InitializeComponent(); 15 | DataContext = Locator.Container.Resolve(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AiZoom/ViewModel/AboutViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using System.Reflection; 3 | 4 | namespace AiZoom.ViewModel 5 | { 6 | public class AboutViewModel : ObservableObject 7 | { 8 | public string CurrentVersion => $"Version - {Assembly.GetExecutingAssembly().GetName().Version.ToString()}"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/AiZoom/ViewModel/HomeViewModel.cs: -------------------------------------------------------------------------------- 1 | using AiZoom.Models; 2 | using Autofac; 3 | using CliWrap; 4 | using CommunityToolkit.Mvvm.ComponentModel; 5 | using CommunityToolkit.Mvvm.Input; 6 | using MahApps.Metro.Controls.Dialogs; 7 | using System; 8 | using System.IO; 9 | using System.Threading.Tasks; 10 | using TG.INI; 11 | using TG.INI.Serialization; 12 | 13 | namespace AiZoom.ViewModel 14 | { 15 | class HomeViewModel : ObservableObject 16 | { 17 | #region 18 | public IRelayCommand OpenImageCmd { get; set; } 19 | public IAsyncRelayCommand StartCmd { get; set; } 20 | 21 | public IAsyncRelayCommand OpenSourceImageCmd { get; set; } 22 | public IAsyncRelayCommand OpenResultImageCmd { get; set; } 23 | 24 | 25 | #endregion 26 | #region Fields 27 | 28 | private IDialogCoordinator _dialog; 29 | #endregion 30 | 31 | #region Properties 32 | 33 | public string SourceImage { get; set; } 34 | 35 | public string ResultImage { get; set; } 36 | public double ProgressValue { get; set; } 37 | public string ProgressString { get; set; } = "0%"; 38 | 39 | #endregion 40 | 41 | public HomeViewModel() 42 | { 43 | _dialog = Locator.Container.Resolve(); 44 | 45 | OpenImageCmd = new RelayCommand(OnOpenImageCmd); 46 | StartCmd = new AsyncRelayCommand(async () => await OnStartCmd()); 47 | OpenSourceImageCmd = new AsyncRelayCommand(OnOpenSourceImageCmd); 48 | OpenResultImageCmd = new AsyncRelayCommand(OnOpenResultImageCmd); 49 | 50 | } 51 | 52 | private async Task OnOpenResultImageCmd() 53 | { 54 | await OpenImage(ResultImage); 55 | } 56 | 57 | private async Task OnOpenSourceImageCmd() 58 | { 59 | await OpenImage(SourceImage); 60 | } 61 | 62 | private async Task OpenImage(string imagePath) 63 | { 64 | var arg = $"/open, \"{imagePath}\""; 65 | var result = await Cli.Wrap("explorer.exe") 66 | .WithArguments(arg) 67 | .ExecuteAsync(); 68 | } 69 | 70 | private async Task OnStartCmd() 71 | { 72 | // get setting 73 | if (!File.Exists(@"config.ini")) 74 | { 75 | await _dialog.ShowMessageAsync(this, "ERROR", "config file is missing."); 76 | return; 77 | } 78 | 79 | var document = new IniDocument(@"config.ini"); 80 | var settings = IniSerialization.DeserializeDocument(document); 81 | 82 | if (string.IsNullOrEmpty(settings.OutputDirectory)) 83 | { 84 | await _dialog.ShowMessageAsync(this, "ERROR", "Output directory is missing."); 85 | return; 86 | } 87 | 88 | var sourceImageFile = new FileInfo(SourceImage); 89 | var sourceImageName = Path.GetFileNameWithoutExtension(sourceImageFile.Name); 90 | 91 | 92 | 93 | 94 | 95 | var engine = @"realesrgan\realesrgan-ncnn-vulkan.exe"; 96 | 97 | var outputFileName = sourceImageName; 98 | 99 | if (!string.IsNullOrEmpty(settings.FileNameSuffix)) 100 | { 101 | outputFileName = $"{outputFileName}_{settings.FileNameSuffix}"; 102 | } 103 | 104 | var outputFileFullName = $"{settings.OutputDirectory}\\{outputFileName}.{settings.OutputFormat}"; 105 | 106 | var arg = $" -i \"{SourceImage}\" -o \"{outputFileFullName}\" -n {settings.Module} -f {settings.OutputFormat} -s 4 -g auto -j 2:2:2 -v"; 107 | 108 | var result = await Cli.Wrap(engine) 109 | .WithArguments(arg) 110 | .WithWorkingDirectory(AppContext.BaseDirectory) 111 | .WithStandardErrorPipe(PipeTarget.ToDelegate(ProcessImage)) 112 | .ExecuteAsync(); 113 | } 114 | 115 | private void ProcessImage(string output) 116 | { 117 | var isPercentage = output.IndexOf("%", 0); 118 | var isDone = output.IndexOf("done", 0); 119 | 120 | // process 121 | if (isPercentage != -1) 122 | { 123 | ProgressString = output; 124 | ProgressValue = Double.Parse(output.Remove(output.Length - 1, 1)); 125 | } 126 | 127 | // done 128 | if (isDone != -1) 129 | { 130 | ProgressString = "100%"; 131 | ProgressValue = 100; 132 | 133 | // get final output file here. if the source images has alpha channel, the original file extension is preserved 134 | var startIndex = output.IndexOf(" -> ", 0); 135 | 136 | var tail = output.Substring(startIndex + 4); 137 | ResultImage = tail.Substring(0, tail.Length - 5); 138 | } 139 | 140 | 141 | 142 | } 143 | 144 | private void OnOpenImageCmd() 145 | { 146 | var dialog = new Ookii.Dialogs.Wpf.VistaOpenFileDialog() { Filter = "jpeg (*.jpg)|*.jpg|PNG (*.png)|*.png|webp (*.webp)|*.webp" }; 147 | 148 | bool? success = dialog.ShowDialog(); 149 | if (success == true) 150 | { 151 | SourceImage = dialog.FileName; 152 | ResultImage = null; 153 | } 154 | 155 | } 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /src/AiZoom/ViewModel/MainViewModel.cs.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using CommunityToolkit.Mvvm.ComponentModel; 3 | using CommunityToolkit.Mvvm.Input; 4 | using MahApps.Metro.Controls.Dialogs; 5 | using System; 6 | using System.Diagnostics; 7 | using System.Threading.Tasks; 8 | 9 | namespace AiZoom.ViewModel 10 | { 11 | public class MainViewModel : ObservableObject 12 | { 13 | #region Relay Commands 14 | 15 | public IAsyncRelayCommand SaveCmd { get; set; } 16 | public IAsyncRelayCommand OpenCmd { get; set; } 17 | public IRelayCommand ExitCmd { get; set; } 18 | 19 | public IAsyncRelayCommand ContentRenderedCmd { get; set; } 20 | #endregion 21 | 22 | #region Fields 23 | 24 | 25 | private IDialogCoordinator _dialog; 26 | #endregion 27 | 28 | #region Properties 29 | 30 | public string Title { get; set; } 31 | 32 | 33 | 34 | #endregion 35 | 36 | 37 | public MainViewModel() 38 | { 39 | ExitCmd = new RelayCommand(() => { Environment.Exit(0); }); 40 | SaveCmd = new AsyncRelayCommand(OnSaveCmd); 41 | ContentRenderedCmd = new AsyncRelayCommand(async () => await OnContentRenderedCmd()); 42 | _dialog = Locator.Container.Resolve(); 43 | 44 | } 45 | 46 | private async Task OnContentRenderedCmd() 47 | { 48 | 49 | } 50 | 51 | 52 | private async Task OnSaveCmd() 53 | { 54 | await _dialog.ShowMessageAsync(this, "Test title", "Test message"); 55 | Debug.WriteLine("test"); 56 | Title = "New test titel"; 57 | //return null; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/AiZoom/ViewModel/SettingViewModel.cs: -------------------------------------------------------------------------------- 1 | using AiZoom.Data; 2 | using AiZoom.Models; 3 | using AiZoom.Services.Interfaces; 4 | using Autofac; 5 | using CommunityToolkit.Mvvm.ComponentModel; 6 | using CommunityToolkit.Mvvm.Input; 7 | using MahApps.Metro.Controls.Dialogs; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Globalization; 11 | using System.IO; 12 | using System.Linq; 13 | using System.Threading; 14 | using TG.INI; 15 | using TG.INI.Serialization; 16 | using WPFLocalizeExtension.Engine; 17 | 18 | namespace AiZoom.ViewModel 19 | { 20 | public class SettingViewModel : ObservableObject 21 | { 22 | #region Commands 23 | public IRelayCommand LoadedCmd { get; set; } 24 | public IRelayCommand SaveCmd { get; set; } 25 | public IRelayCommand DiscardCmd { get; set; } 26 | public IRelayCommand RestoreCmd { get; set; } 27 | public IRelayCommand BrowseFolderCmd { get; set; } 28 | 29 | public IRelayCommand LocaleSelectionChangedCmd { get; set; } 30 | 31 | #endregion 32 | 33 | #region Fields 34 | 35 | private IDialogCoordinator _dialog; 36 | #endregion 37 | 38 | #region Properties 39 | 40 | public List Locales { get; set; } 41 | public LocaleModel SelectedLocale { get; set; } 42 | 43 | public List Modules { get; set; } 44 | public string SelectedModule { get; set; } 45 | 46 | public string FileNameSuffix { get; set; } 47 | 48 | public List OutputFormats => new List() { "jpg", "png", "webp" }; 49 | public string SelectedOutputFormat { get; set; } 50 | 51 | public string OutputDirectory { get; set; } 52 | #endregion 53 | 54 | public SettingViewModel() 55 | { 56 | _dialog = Locator.Container.Resolve(); 57 | LoadedCmd = new RelayCommand(OnLoadedCmd); 58 | SaveCmd = new RelayCommand(OnSaveCmd); 59 | DiscardCmd = new RelayCommand(OnDiscardCmd); 60 | RestoreCmd = new RelayCommand(OnRestoreCmd); 61 | BrowseFolderCmd = new RelayCommand(OnBrowseFolderCmd); 62 | LocaleSelectionChangedCmd = new RelayCommand(OnLocaleSelectionChangedCmd); 63 | } 64 | 65 | private void OnLocaleSelectionChangedCmd() 66 | { 67 | LocalizeDictionary.Instance.Culture = new CultureInfo(SelectedLocale.Code); 68 | Thread.CurrentThread.CurrentCulture = new CultureInfo(SelectedLocale.Code); 69 | } 70 | 71 | private void OnBrowseFolderCmd() 72 | { 73 | var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); 74 | 75 | bool? success = dialog.ShowDialog(); 76 | if (success == true) 77 | { 78 | OutputDirectory = dialog.SelectedPath; 79 | } 80 | } 81 | 82 | private void OnRestoreCmd() 83 | { 84 | SelectedLocale = Locales.First(x => x.Code == "en"); 85 | SelectedModule = "realesrgan-x4plus"; 86 | FileNameSuffix = ""; 87 | SelectedOutputFormat = "jpg"; 88 | OutputDirectory = $"{AppContext.BaseDirectory}output"; 89 | 90 | OnSaveCmd(); 91 | } 92 | 93 | private void OnDiscardCmd() 94 | { 95 | if (File.Exists(@"config.ini")) 96 | { 97 | var document = new IniDocument(@"config.ini"); 98 | var settings = IniSerialization.DeserializeDocument(document); 99 | 100 | SelectedLocale = Locales.First(x => x.Code == settings.Locale); 101 | 102 | if (Modules.Contains(settings.Module)) 103 | SelectedModule = settings.Module; 104 | 105 | FileNameSuffix = settings.FileNameSuffix; 106 | SelectedOutputFormat = settings.OutputFormat; 107 | OutputDirectory = settings.OutputDirectory; 108 | } 109 | else 110 | { 111 | OnRestoreCmd(); 112 | } 113 | } 114 | 115 | private void OnSaveCmd() 116 | { 117 | var settings = new SettingModel() 118 | { 119 | Locale = SelectedLocale.Code, 120 | Module = SelectedModule, 121 | FileNameSuffix = FileNameSuffix, 122 | OutputFormat = SelectedOutputFormat, 123 | OutputDirectory = OutputDirectory 124 | }; 125 | var doc = IniSerialization.SerializeObjectToNewDocument(settings); 126 | doc.Write(@"config.ini"); 127 | } 128 | 129 | private void OnLoadedCmd() 130 | { 131 | var moduleService = Locator.Container.Resolve(); 132 | Modules = moduleService.GetModules(); 133 | 134 | var localeService = Locator.Container.Resolve(); 135 | Locales = localeService.GetLocale(); 136 | OnDiscardCmd(); 137 | } 138 | } 139 | } -------------------------------------------------------------------------------- /src/AiZoom/config.ini: -------------------------------------------------------------------------------- 1 | Locale="en" 2 | Module="realesrgan-x4plus" 3 | FileNameSuffix="" 4 | OutputFormat="jpg" 5 | OutputDirectory="" -------------------------------------------------------------------------------- /src/AiZoom/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedipi/AI-Image-Zoom/6b713b26ac1ce826cd61bd06b91c587bb3349655/src/AiZoom/icon.ico --------------------------------------------------------------------------------