├── .gitattributes
├── .gitignore
├── ConvertFromWebp.bat
├── ConvertToWebp.bat
├── LICENSE.txt
├── LibWebpToolsGUI.sln
├── README.md
├── cWebpGUI
├── App.config
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── 16_info.png
│ ├── 24_info.png
│ └── 32_info.png
├── cWebpGUI.Designer.cs
├── cWebpGUI.cs
├── cWebpGUI.csproj
├── cWebpGUI.resx
└── cWebpProgram.cs
└── dWebpGUI
├── App.config
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── dWebPGUI.csproj
├── dWebpGUI.Designer.cs
├── dWebpGUI.cs
├── dWebpGUI.resx
└── dWebpProgram.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.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 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/ConvertFromWebp.bat:
--------------------------------------------------------------------------------
1 | :: This lets you convert a webp file to something else by simply dragging the file onto this batch script in File Explorer
2 | :: Lines beginning with "::" are comments
3 | ::
4 | :: Note: Requires "dwebp.exe" from Google's libwebp tools, available here: https://developers.google.com/speed/webp/docs/precompiled
5 |
6 | @echo off
7 | setlocal
8 |
9 | :: Extract the file name without the extension
10 | set "inputFile=%~1"
11 | set "baseFileName=%~n1"
12 |
13 | :: Run the conversion - You can customize the command by adding parameters
14 | :: See the possible options here: https://developers.google.com/speed/webp/docs/dwebp
15 | dwebp -mt "%inputFile%" -o "%baseFileName%.png"
16 |
17 |
18 | echo Conversion completed.
19 |
20 | :: If you want the console window to stay open after it finishes, remove the "::" from the beginning of the line below
21 | ::pause
22 |
--------------------------------------------------------------------------------
/ConvertToWebp.bat:
--------------------------------------------------------------------------------
1 | :: This lets you convert a file to webp by simply dragging the file onto this batch script in File Explorer
2 | :: Lines beginning with "::" are comments
3 | ::
4 | :: Note: Requires "cwebp.exe" from Google's libwebp tools, available here: https://developers.google.com/speed/webp/docs/precompiled
5 |
6 | @echo off
7 | setlocal
8 |
9 | :: Extract the file name without the extension
10 | set "inputFile=%~1"
11 | set "baseFileName=%~n1"
12 |
13 | :: Run the conversion - You can customize the command by adding parameters
14 | :: See the possible options here: https://developers.google.com/speed/webp/docs/cwebp
15 | cwebp -q 90 "%inputFile%" -o "%baseFileName%.webp"
16 |
17 |
18 | echo Conversion completed.
19 |
20 | :: If you want the console window to stay open after it finishes, remove the "::" from the beginning of the line below
21 | ::pause
22 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) [year] [fullname]
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 |
--------------------------------------------------------------------------------
/LibWebpToolsGUI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.9.34701.34
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dWebPGUI", "dWebpGUI\dWebPGUI.csproj", "{C5CB6412-6FD6-4027-830B-B7C573F58E68}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cWebpGUI", "cWebpGUI\cWebpGUI.csproj", "{0DD4754C-E58A-4DA2-95C5-1F1FCD9FDEEF}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {C5CB6412-6FD6-4027-830B-B7C573F58E68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {C5CB6412-6FD6-4027-830B-B7C573F58E68}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {C5CB6412-6FD6-4027-830B-B7C573F58E68}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {C5CB6412-6FD6-4027-830B-B7C573F58E68}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {0DD4754C-E58A-4DA2-95C5-1F1FCD9FDEEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {0DD4754C-E58A-4DA2-95C5-1F1FCD9FDEEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {0DD4754C-E58A-4DA2-95C5-1F1FCD9FDEEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {0DD4754C-E58A-4DA2-95C5-1F1FCD9FDEEF}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {A4FE00C9-E8D0-4BF1-BBD0-91835675449F}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LibWebpToolsGUI
2 |
3 | GUI wrappers to use with the cWebP and dWebP binaries part of LibWebp.
4 |
5 | - cWebpGUI: Convert to WebP format using cWebp.exe
6 | - dWebpGUI: Convert from WebP format using dWebp.exe
7 |
8 | ## Prerequisites:
9 | - Obtain the libwebp binaries from here: https://developers.google.com/speed/webp/docs/precompiled
10 | - Select the one with the name "`...-windows-x64.zip` : 64-bit executables and libraries for Windows-x64 platform."
11 | - Place the GUI exes in the same folder as cwebp.exe and dwebp.exe
12 |
13 | ## How to Download:
14 | - Find the files on the Releases page: https://github.com/ThioJoe/LibWebpToolsGUI/releases
15 |
16 | ## Screenshots:
17 |
18 | ### cWebpGUI:
19 |
20 |
21 |
22 | ### dWebpGUI:
23 |
24 |
--------------------------------------------------------------------------------
/cWebpGUI/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/cWebpGUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
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("cWebpGUI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("cWebpGUI")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
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 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0dd4754c-e58a-4da2-95c5-1f1fcd9fdeef")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/cWebpGUI/Properties/Resources.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 cWebpGUI.Properties {
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", "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 | /// 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("cWebpGUI.Properties.Resources", typeof(Resources).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 1.0.0.
65 | ///
66 | internal static string Version {
67 | get {
68 | return ResourceManager.GetString("Version", resourceCulture);
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/cWebpGUI/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 |
--------------------------------------------------------------------------------
/cWebpGUI/Properties/Settings.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 cWebpGUI.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.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 | }
27 |
--------------------------------------------------------------------------------
/cWebpGUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/cWebpGUI/Resources/16_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThioJoe/LibWebpToolsGUI/9ed972109f926d4078a109c4db80442774875453/cWebpGUI/Resources/16_info.png
--------------------------------------------------------------------------------
/cWebpGUI/Resources/24_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThioJoe/LibWebpToolsGUI/9ed972109f926d4078a109c4db80442774875453/cWebpGUI/Resources/24_info.png
--------------------------------------------------------------------------------
/cWebpGUI/Resources/32_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThioJoe/LibWebpToolsGUI/9ed972109f926d4078a109c4db80442774875453/cWebpGUI/Resources/32_info.png
--------------------------------------------------------------------------------
/cWebpGUI/cWebpGUI.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace cWebpGUI
2 | {
3 | partial class cWebpGUI
4 | {
5 | private System.ComponentModel.IContainer components = null;
6 |
7 | protected override void Dispose(bool disposing)
8 | {
9 | if (disposing && (components != null))
10 | {
11 | components.Dispose();
12 | }
13 | base.Dispose(disposing);
14 | }
15 |
16 | #region Windows Form Designer generated code
17 |
18 | private void InitializeComponent()
19 | {
20 | this.components = new System.ComponentModel.Container();
21 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(cWebpGUI));
22 | this.lblInputFile = new System.Windows.Forms.Label();
23 | this.txtInputFile = new System.Windows.Forms.TextBox();
24 | this.lblOutputFile = new System.Windows.Forms.Label();
25 | this.txtOutputFile = new System.Windows.Forms.TextBox();
26 | this.chkLossless = new System.Windows.Forms.CheckBox();
27 | this.chkMultiThreading = new System.Windows.Forms.CheckBox();
28 | this.chkLowMemory = new System.Windows.Forms.CheckBox();
29 | this.lblQuality = new System.Windows.Forms.Label();
30 | this.txtQuality = new System.Windows.Forms.TextBox();
31 | this.lblAlphaQuality = new System.Windows.Forms.Label();
32 | this.txtAlphaQuality = new System.Windows.Forms.TextBox();
33 | this.lblPreset = new System.Windows.Forms.Label();
34 | this.cmbPreset = new System.Windows.Forms.ComboBox();
35 | this.lblMethod = new System.Windows.Forms.Label();
36 | this.cmbMethod = new System.Windows.Forms.ComboBox();
37 | this.btnConvert = new System.Windows.Forms.Button();
38 | this.lblCommandPreview = new System.Windows.Forms.Label();
39 | this.txtCommandPreview = new System.Windows.Forms.TextBox();
40 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
41 | this.pictureBox2 = new System.Windows.Forms.PictureBox();
42 | this.pictureBox3 = new System.Windows.Forms.PictureBox();
43 | this.pictureBox4 = new System.Windows.Forms.PictureBox();
44 | this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
45 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
46 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
47 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
48 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
49 | this.SuspendLayout();
50 | //
51 | // lblInputFile
52 | //
53 | this.lblInputFile.AutoSize = true;
54 | this.lblInputFile.Location = new System.Drawing.Point(12, 15);
55 | this.lblInputFile.Name = "lblInputFile";
56 | this.lblInputFile.Size = new System.Drawing.Size(50, 13);
57 | this.lblInputFile.TabIndex = 0;
58 | this.lblInputFile.Text = "Input File";
59 | //
60 | // txtInputFile
61 | //
62 | this.txtInputFile.Location = new System.Drawing.Point(100, 12);
63 | this.txtInputFile.Name = "txtInputFile";
64 | this.txtInputFile.Size = new System.Drawing.Size(162, 20);
65 | this.txtInputFile.TabIndex = 1;
66 | this.txtInputFile.TextChanged += new System.EventHandler(this.txtInputFile_TextChanged);
67 | //
68 | // lblOutputFile
69 | //
70 | this.lblOutputFile.AutoSize = true;
71 | this.lblOutputFile.Location = new System.Drawing.Point(12, 41);
72 | this.lblOutputFile.Name = "lblOutputFile";
73 | this.lblOutputFile.Size = new System.Drawing.Size(58, 13);
74 | this.lblOutputFile.TabIndex = 2;
75 | this.lblOutputFile.Text = "Output File";
76 | //
77 | // txtOutputFile
78 | //
79 | this.txtOutputFile.Location = new System.Drawing.Point(100, 38);
80 | this.txtOutputFile.Name = "txtOutputFile";
81 | this.txtOutputFile.Size = new System.Drawing.Size(162, 20);
82 | this.txtOutputFile.TabIndex = 3;
83 | this.txtOutputFile.TextChanged += new System.EventHandler(this.txtOutputFile_TextChanged);
84 | //
85 | // chkLossless
86 | //
87 | this.chkLossless.AutoSize = true;
88 | this.chkLossless.Location = new System.Drawing.Point(15, 70);
89 | this.chkLossless.Name = "chkLossless";
90 | this.chkLossless.Size = new System.Drawing.Size(73, 21);
91 | this.chkLossless.TabIndex = 4;
92 | this.chkLossless.Text = "Lossless";
93 | this.chkLossless.UseVisualStyleBackColor = true;
94 | this.chkLossless.CheckedChanged += new System.EventHandler(this.chkLossless_CheckedChanged);
95 | //
96 | // chkMultiThreading
97 | //
98 | this.chkMultiThreading.AutoSize = true;
99 | this.chkMultiThreading.Location = new System.Drawing.Point(15, 93);
100 | this.chkMultiThreading.Name = "chkMultiThreading";
101 | this.chkMultiThreading.Size = new System.Drawing.Size(106, 21);
102 | this.chkMultiThreading.TabIndex = 5;
103 | this.chkMultiThreading.Text = "Multi-Threading";
104 | this.chkMultiThreading.UseVisualStyleBackColor = true;
105 | this.chkMultiThreading.CheckedChanged += new System.EventHandler(this.chkMultiThreading_CheckedChanged);
106 | //
107 | // chkLowMemory
108 | //
109 | this.chkLowMemory.AutoSize = true;
110 | this.chkLowMemory.Location = new System.Drawing.Point(15, 116);
111 | this.chkLowMemory.Name = "chkLowMemory";
112 | this.chkLowMemory.Size = new System.Drawing.Size(93, 21);
113 | this.chkLowMemory.TabIndex = 6;
114 | this.chkLowMemory.Text = "Low Memory";
115 | this.chkLowMemory.UseVisualStyleBackColor = true;
116 | this.chkLowMemory.CheckedChanged += new System.EventHandler(this.chkLowMemory_CheckedChanged);
117 | //
118 | // lblQuality
119 | //
120 | this.lblQuality.AutoSize = true;
121 | this.lblQuality.Location = new System.Drawing.Point(12, 145);
122 | this.lblQuality.Name = "lblQuality";
123 | this.lblQuality.Size = new System.Drawing.Size(75, 13);
124 | this.lblQuality.TabIndex = 7;
125 | this.lblQuality.Text = "Quality (0-100)";
126 | //
127 | // txtQuality
128 | //
129 | this.txtQuality.Location = new System.Drawing.Point(100, 142);
130 | this.txtQuality.Name = "txtQuality";
131 | this.txtQuality.Size = new System.Drawing.Size(100, 20);
132 | this.txtQuality.TabIndex = 8;
133 | this.txtQuality.TextChanged += new System.EventHandler(this.txtQuality_TextChanged);
134 | //
135 | // lblAlphaQuality
136 | //
137 | this.lblAlphaQuality.AutoSize = true;
138 | this.lblAlphaQuality.Location = new System.Drawing.Point(12, 171);
139 | this.lblAlphaQuality.Name = "lblAlphaQuality";
140 | this.lblAlphaQuality.Size = new System.Drawing.Size(69, 13);
141 | this.lblAlphaQuality.TabIndex = 9;
142 | this.lblAlphaQuality.Text = "Alpha Quality";
143 | //
144 | // txtAlphaQuality
145 | //
146 | this.txtAlphaQuality.Location = new System.Drawing.Point(100, 168);
147 | this.txtAlphaQuality.Name = "txtAlphaQuality";
148 | this.txtAlphaQuality.Size = new System.Drawing.Size(100, 20);
149 | this.txtAlphaQuality.TabIndex = 10;
150 | this.txtAlphaQuality.TextChanged += new System.EventHandler(this.txtAlphaQuality_TextChanged);
151 | //
152 | // lblPreset
153 | //
154 | this.lblPreset.AutoSize = true;
155 | this.lblPreset.Location = new System.Drawing.Point(12, 197);
156 | this.lblPreset.Name = "lblPreset";
157 | this.lblPreset.Size = new System.Drawing.Size(37, 13);
158 | this.lblPreset.TabIndex = 11;
159 | this.lblPreset.Text = "Preset";
160 | //
161 | // cmbPreset
162 | //
163 | this.cmbPreset.FormattingEnabled = true;
164 | this.cmbPreset.Items.AddRange(new object[] {
165 | "",
166 | "default",
167 | "photo",
168 | "picture",
169 | "drawing",
170 | "icon",
171 | "text"});
172 | this.cmbPreset.Location = new System.Drawing.Point(100, 195);
173 | this.cmbPreset.Name = "cmbPreset";
174 | this.cmbPreset.Size = new System.Drawing.Size(100, 21);
175 | this.cmbPreset.TabIndex = 12;
176 | this.cmbPreset.SelectedIndexChanged += new System.EventHandler(this.cmbPreset_SelectedIndexChanged);
177 | //
178 | // lblMethod
179 | //
180 | this.lblMethod.AutoSize = true;
181 | this.lblMethod.Location = new System.Drawing.Point(12, 224);
182 | this.lblMethod.Name = "lblMethod";
183 | this.lblMethod.Size = new System.Drawing.Size(43, 13);
184 | this.lblMethod.TabIndex = 13;
185 | this.lblMethod.Text = "Method";
186 | //
187 | // cmbMethod
188 | //
189 | this.cmbMethod.FormattingEnabled = true;
190 | this.cmbMethod.Items.AddRange(new object[] {
191 | "",
192 | "0",
193 | "1",
194 | "2",
195 | "3",
196 | "4 (Default)",
197 | "5",
198 | "6"});
199 | this.cmbMethod.Location = new System.Drawing.Point(100, 224);
200 | this.cmbMethod.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
201 | this.cmbMethod.Name = "cmbMethod";
202 | this.cmbMethod.Size = new System.Drawing.Size(68, 21);
203 | this.cmbMethod.TabIndex = 14;
204 | this.cmbMethod.SelectedIndexChanged += new System.EventHandler(this.cmbMethod_SelectedIndexChanged);
205 | //
206 | // btnConvert
207 | //
208 | this.btnConvert.Location = new System.Drawing.Point(15, 260);
209 | this.btnConvert.Name = "btnConvert";
210 | this.btnConvert.Size = new System.Drawing.Size(75, 23);
211 | this.btnConvert.TabIndex = 15;
212 | this.btnConvert.Text = "Convert";
213 | this.btnConvert.UseVisualStyleBackColor = true;
214 | this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
215 | //
216 | // lblCommandPreview
217 | //
218 | this.lblCommandPreview.AutoSize = true;
219 | this.lblCommandPreview.Location = new System.Drawing.Point(12, 300);
220 | this.lblCommandPreview.Name = "lblCommandPreview";
221 | this.lblCommandPreview.Size = new System.Drawing.Size(98, 13);
222 | this.lblCommandPreview.TabIndex = 16;
223 | this.lblCommandPreview.Text = "Command Preview:";
224 | //
225 | // txtCommandPreview
226 | //
227 | this.txtCommandPreview.Location = new System.Drawing.Point(15, 320);
228 | this.txtCommandPreview.Multiline = true;
229 | this.txtCommandPreview.Name = "txtCommandPreview";
230 | this.txtCommandPreview.ReadOnly = true;
231 | this.txtCommandPreview.Size = new System.Drawing.Size(260, 60);
232 | this.txtCommandPreview.TabIndex = 17;
233 | //
234 | // pictureBox1
235 | //
236 | this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
237 | this.pictureBox1.Location = new System.Drawing.Point(211, 142);
238 | this.pictureBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
239 | this.pictureBox1.Name = "pictureBox1";
240 | this.pictureBox1.Size = new System.Drawing.Size(16, 16);
241 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
242 | this.pictureBox1.TabIndex = 18;
243 | this.pictureBox1.TabStop = false;
244 | this.toolTip1.SetToolTip(this.pictureBox1, resources.GetString("pictureBox1.ToolTip"));
245 | //
246 | // pictureBox2
247 | //
248 | this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
249 | this.pictureBox2.Location = new System.Drawing.Point(211, 168);
250 | this.pictureBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
251 | this.pictureBox2.Name = "pictureBox2";
252 | this.pictureBox2.Size = new System.Drawing.Size(16, 16);
253 | this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
254 | this.pictureBox2.TabIndex = 19;
255 | this.pictureBox2.TabStop = false;
256 | this.toolTip1.SetToolTip(this.pictureBox2, resources.GetString("pictureBox2.ToolTip"));
257 | //
258 | // pictureBox3
259 | //
260 | this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
261 | this.pictureBox3.Location = new System.Drawing.Point(211, 198);
262 | this.pictureBox3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
263 | this.pictureBox3.Name = "pictureBox3";
264 | this.pictureBox3.Size = new System.Drawing.Size(16, 16);
265 | this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
266 | this.pictureBox3.TabIndex = 20;
267 | this.pictureBox3.TabStop = false;
268 | this.toolTip1.SetToolTip(this.pictureBox3, "Specify a set of pre-defined parameters to suit a particular type of source mater" +
269 | "ial.\r\n\r\nThis will override other parameter values (except Quality)");
270 | //
271 | // pictureBox4
272 | //
273 | this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
274 | this.pictureBox4.Location = new System.Drawing.Point(211, 227);
275 | this.pictureBox4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
276 | this.pictureBox4.Name = "pictureBox4";
277 | this.pictureBox4.Size = new System.Drawing.Size(16, 16);
278 | this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
279 | this.pictureBox4.TabIndex = 21;
280 | this.pictureBox4.TabStop = false;
281 | this.toolTip1.SetToolTip(this.pictureBox4, resources.GetString("pictureBox4.ToolTip"));
282 | //
283 | // Form1
284 | //
285 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
286 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
287 | this.ClientSize = new System.Drawing.Size(282, 400);
288 | this.Controls.Add(this.pictureBox4);
289 | this.Controls.Add(this.pictureBox3);
290 | this.Controls.Add(this.pictureBox2);
291 | this.Controls.Add(this.pictureBox1);
292 | this.Controls.Add(this.txtCommandPreview);
293 | this.Controls.Add(this.lblCommandPreview);
294 | this.Controls.Add(this.btnConvert);
295 | this.Controls.Add(this.cmbMethod);
296 | this.Controls.Add(this.lblMethod);
297 | this.Controls.Add(this.cmbPreset);
298 | this.Controls.Add(this.lblPreset);
299 | this.Controls.Add(this.txtAlphaQuality);
300 | this.Controls.Add(this.lblAlphaQuality);
301 | this.Controls.Add(this.txtQuality);
302 | this.Controls.Add(this.lblQuality);
303 | this.Controls.Add(this.chkLowMemory);
304 | this.Controls.Add(this.chkMultiThreading);
305 | this.Controls.Add(this.chkLossless);
306 | this.Controls.Add(this.txtOutputFile);
307 | this.Controls.Add(this.lblOutputFile);
308 | this.Controls.Add(this.txtInputFile);
309 | this.Controls.Add(this.lblInputFile);
310 | this.Name = "Form1";
311 | this.Text = "cWebp GUI";
312 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
313 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
314 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
315 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
316 | this.ResumeLayout(false);
317 | this.PerformLayout();
318 |
319 | }
320 |
321 | #endregion
322 |
323 | private System.Windows.Forms.Label lblInputFile;
324 | private System.Windows.Forms.TextBox txtInputFile;
325 | private System.Windows.Forms.Label lblOutputFile;
326 | private System.Windows.Forms.TextBox txtOutputFile;
327 | private System.Windows.Forms.CheckBox chkLossless;
328 | private System.Windows.Forms.CheckBox chkMultiThreading;
329 | private System.Windows.Forms.CheckBox chkLowMemory;
330 | private System.Windows.Forms.Label lblQuality;
331 | private System.Windows.Forms.TextBox txtQuality;
332 | private System.Windows.Forms.Label lblAlphaQuality;
333 | private System.Windows.Forms.TextBox txtAlphaQuality;
334 | private System.Windows.Forms.Label lblPreset;
335 | private System.Windows.Forms.ComboBox cmbPreset;
336 | private System.Windows.Forms.Label lblMethod;
337 | private System.Windows.Forms.ComboBox cmbMethod;
338 | private System.Windows.Forms.Button btnConvert;
339 | private System.Windows.Forms.Label lblCommandPreview;
340 | private System.Windows.Forms.TextBox txtCommandPreview;
341 | private System.Windows.Forms.PictureBox pictureBox1;
342 | private System.Windows.Forms.ToolTip toolTip1;
343 | private System.Windows.Forms.PictureBox pictureBox2;
344 | private System.Windows.Forms.PictureBox pictureBox3;
345 | private System.Windows.Forms.PictureBox pictureBox4;
346 | }
347 | }
--------------------------------------------------------------------------------
/cWebpGUI/cWebpGUI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Windows.Forms;
5 |
6 | namespace cWebpGUI
7 | {
8 | public partial class cWebpGUI : Form
9 | {
10 | public cWebpGUI()
11 | {
12 | InitializeComponent();
13 | UpdateCommandPreview();
14 | }
15 |
16 | private void btnConvert_Click(object sender, EventArgs e)
17 | {
18 | string inputFile = txtInputFile.Text;
19 | string outputFile = txtOutputFile.Text;
20 | string options = BuildOptions();
21 |
22 | inputFile = inputFile.Trim('"');
23 |
24 | if (File.Exists(inputFile))
25 | {
26 | if (string.IsNullOrWhiteSpace(outputFile))
27 | {
28 | string directory = Path.GetDirectoryName(inputFile);
29 | string filenameWithoutExtension = Path.GetFileNameWithoutExtension(inputFile);
30 | outputFile = Path.Combine(directory, filenameWithoutExtension + ".webp");
31 | }
32 | else
33 | {
34 | outputFile = outputFile.Trim('"');
35 | if (!outputFile.EndsWith(".webp", StringComparison.OrdinalIgnoreCase))
36 | {
37 | outputFile += ".webp";
38 | }
39 | outputFile = Path.Combine(Path.GetDirectoryName(inputFile), outputFile);
40 | }
41 |
42 | string command = $"cwebp {options} \"{inputFile}\" -o \"{outputFile}\"";
43 | RunCommand(command);
44 | }
45 | else
46 | {
47 | MessageBox.Show("Input file does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
48 | }
49 | }
50 |
51 |
52 |
53 | private string BuildOptions()
54 | {
55 | string options = "";
56 |
57 | if (chkLossless.Checked)
58 | options += " -lossless";
59 |
60 | if (chkMultiThreading.Checked)
61 | options += " -mt";
62 |
63 | if (chkLowMemory.Checked)
64 | options += " -low_memory";
65 |
66 | if (!string.IsNullOrWhiteSpace(txtQuality.Text))
67 | options += $" -q {txtQuality.Text}";
68 |
69 | if (!string.IsNullOrWhiteSpace(txtAlphaQuality.Text))
70 | options += $" -alpha_q {txtAlphaQuality.Text}";
71 |
72 | if (cmbPreset.SelectedIndex > 0)
73 | options += $" -preset {cmbPreset.SelectedItem}";
74 |
75 | if (cmbMethod.SelectedIndex > 0)
76 | options += $" -m {cmbMethod.SelectedItem}";
77 |
78 | return options;
79 | }
80 |
81 | private void RunCommand(string command)
82 | {
83 | ProcessStartInfo processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
84 | processInfo.CreateNoWindow = true;
85 | processInfo.UseShellExecute = false;
86 | processInfo.RedirectStandardError = true;
87 | processInfo.RedirectStandardOutput = true;
88 |
89 | Process process = new Process();
90 | process.StartInfo = processInfo;
91 | process.Start();
92 |
93 | string output = process.StandardOutput.ReadToEnd();
94 | string error = process.StandardError.ReadToEnd();
95 |
96 | process.WaitForExit();
97 |
98 | if (error.StartsWith("Error!"))
99 | {
100 | MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
101 | }
102 | else
103 | {
104 | //MessageBox.Show("Conversion completed successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
105 | // Display the informational messages in a message box or log them
106 | MessageBox.Show(error, "Success - Conversion Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
107 | }
108 | }
109 |
110 | private void UpdateCommandPreview()
111 | {
112 | string inputFile = txtInputFile.Text;
113 | string outputFile = txtOutputFile.Text;
114 | string options = BuildOptions();
115 |
116 | inputFile = inputFile.Trim('"');
117 |
118 | if (string.IsNullOrWhiteSpace(outputFile))
119 | {
120 | if (!string.IsNullOrWhiteSpace(inputFile))
121 | {
122 | string directory = Path.GetDirectoryName(inputFile);
123 | string filenameWithoutExtension = Path.GetFileNameWithoutExtension(inputFile);
124 | outputFile = Path.Combine(directory, filenameWithoutExtension + ".webp");
125 | }
126 | }
127 | else
128 | {
129 | outputFile = outputFile.Trim('"');
130 | if (!outputFile.EndsWith(".webp", StringComparison.OrdinalIgnoreCase))
131 | {
132 | outputFile += ".webp";
133 | }
134 | outputFile = Path.Combine(Path.GetDirectoryName(inputFile), outputFile);
135 | }
136 |
137 | string command = $"cwebp {options} \"{inputFile}\" -o \"{outputFile}\"";
138 | txtCommandPreview.Text = command;
139 | }
140 |
141 |
142 |
143 | private void txtInputFile_TextChanged(object sender, EventArgs e)
144 | {
145 | UpdateCommandPreview();
146 | }
147 |
148 | private void txtOutputFile_TextChanged(object sender, EventArgs e)
149 | {
150 | UpdateCommandPreview();
151 | }
152 |
153 | private void chkLossless_CheckedChanged(object sender, EventArgs e)
154 | {
155 | UpdateCommandPreview();
156 | }
157 |
158 | private void chkMultiThreading_CheckedChanged(object sender, EventArgs e)
159 | {
160 | UpdateCommandPreview();
161 | }
162 |
163 | private void chkLowMemory_CheckedChanged(object sender, EventArgs e)
164 | {
165 | UpdateCommandPreview();
166 | }
167 |
168 | private void txtQuality_TextChanged(object sender, EventArgs e)
169 | {
170 | UpdateCommandPreview();
171 | }
172 |
173 | private void txtAlphaQuality_TextChanged(object sender, EventArgs e)
174 | {
175 | UpdateCommandPreview();
176 | }
177 |
178 | private void cmbPreset_SelectedIndexChanged(object sender, EventArgs e)
179 | {
180 | UpdateCommandPreview();
181 | }
182 |
183 | private void cmbMethod_SelectedIndexChanged(object sender, EventArgs e)
184 | {
185 | UpdateCommandPreview();
186 | }
187 | }
188 | }
--------------------------------------------------------------------------------
/cWebpGUI/cWebpGUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {0DD4754C-E58A-4DA2-95C5-1F1FCD9FDEEF}
8 | WinExe
9 | cWebpGUI
10 | cWebpGUI
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | Form
51 |
52 |
53 | cWebpGUI.cs
54 |
55 |
56 |
57 |
58 | cWebpGUI.cs
59 |
60 |
61 | ResXFileCodeGenerator
62 | Resources.Designer.cs
63 | Designer
64 |
65 |
66 | True
67 | Resources.resx
68 | True
69 |
70 |
71 | SettingsSingleFileGenerator
72 | Settings.Designer.cs
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/cWebpGUI/cWebpGUI.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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 |
123 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
124 | EAAACxABrSO9dQAAANdJREFUOE+lk7ENwjAQRb0ALEGXCWgtpcgCLEQXiQoGgCId1JkACDOhSOFedLaO
125 | 4ERAiied/7/7ih3bee9dnueWtXAWWqFTqC8CXuxl1hVFYTkKnXIX9gp10E9CnOmTdHEVaNgJS9UsCwGP
126 | nhsasyGgUmODYTgoVqOH3ioEZCrwqbYR0GGo08vZZATULIxpWSkpj4CaAIabgRl4KCmvYTYElAMzMLYF
127 | KL8JeCop7y1gbAtTAXELU4fYKikvHuLs34gwdpG2itU+LlIw/rvKFIbfH9O85+zdC8b3LMIYY2EGAAAA
128 | AElFTkSuQmCC
129 |
130 |
131 |
132 | 17, 17
133 |
134 |
135 | Specify the compression factor for RGB channels between 0 and 100. The default is 75.
136 |
137 | In case of lossy compression (default), a small factor produces a smaller file with lower quality.
138 | Best quality is achieved by using a value of 100.
139 |
140 | In case of lossless compression (specified by the -lossless option),
141 | a small factor enables faster compression speed, but produces a larger file.
142 | Maximum compression is achieved by using a value of 100.
143 |
144 |
145 |
146 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
147 | EAAACxABrSO9dQAAANdJREFUOE+lk7ENwjAQRb0ALEGXCWgtpcgCLEQXiQoGgCId1JkACDOhSOFedLaO
148 | 4ERAiied/7/7ih3bee9dnueWtXAWWqFTqC8CXuxl1hVFYTkKnXIX9gp10E9CnOmTdHEVaNgJS9UsCwGP
149 | nhsasyGgUmODYTgoVqOH3ioEZCrwqbYR0GGo08vZZATULIxpWSkpj4CaAIabgRl4KCmvYTYElAMzMLYF
150 | KL8JeCop7y1gbAtTAXELU4fYKikvHuLs34gwdpG2itU+LlIw/rvKFIbfH9O85+zdC8b3LMIYY2EGAAAA
151 | AElFTkSuQmCC
152 |
153 |
154 |
155 | Specify the compression factor for alpha compression between 0 and 100.
156 |
157 | Lossless compression of alpha is achieved using a value of 100,
158 | while the lower values result in a lossy compression.
159 |
160 | The default is 100.
161 |
162 |
163 |
164 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
165 | EAAACxABrSO9dQAAANdJREFUOE+lk7ENwjAQRb0ALEGXCWgtpcgCLEQXiQoGgCId1JkACDOhSOFedLaO
166 | 4ERAiied/7/7ih3bee9dnueWtXAWWqFTqC8CXuxl1hVFYTkKnXIX9gp10E9CnOmTdHEVaNgJS9UsCwGP
167 | nhsasyGgUmODYTgoVqOH3ioEZCrwqbYR0GGo08vZZATULIxpWSkpj4CaAIabgRl4KCmvYTYElAMzMLYF
168 | KL8JeCop7y1gbAtTAXELU4fYKikvHuLs34gwdpG2itU+LlIw/rvKFIbfH9O85+zdC8b3LMIYY2EGAAAA
169 | AElFTkSuQmCC
170 |
171 |
172 |
173 |
174 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
175 | EAAACxABrSO9dQAAANdJREFUOE+lk7ENwjAQRb0ALEGXCWgtpcgCLEQXiQoGgCId1JkACDOhSOFedLaO
176 | 4ERAiied/7/7ih3bee9dnueWtXAWWqFTqC8CXuxl1hVFYTkKnXIX9gp10E9CnOmTdHEVaNgJS9UsCwGP
177 | nhsasyGgUmODYTgoVqOH3ioEZCrwqbYR0GGo08vZZATULIxpWSkpj4CaAIabgRl4KCmvYTYElAMzMLYF
178 | KL8JeCop7y1gbAtTAXELU4fYKikvHuLs34gwdpG2itU+LlIw/rvKFIbfH9O85+zdC8b3LMIYY2EGAAAA
179 | AElFTkSuQmCC
180 |
181 |
182 |
183 | Specify the compression method to use. Default value is 4.
184 |
185 | This parameter controls the trade off between encoding speed and the compressed file size and quality.
186 |
187 | When higher values are used, the encoder will spend more time inspecting additional encoding possibilities
188 | and decide on the quality gain. Lower value can result in faster processing time at the expense of larger file size
189 | and lower compression quality.
190 |
191 |
--------------------------------------------------------------------------------
/cWebpGUI/cWebpProgram.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace cWebpGUI
5 | {
6 | static class Program
7 | {
8 | [STAThread]
9 | static void Main()
10 | {
11 | Application.EnableVisualStyles();
12 | Application.SetCompatibleTextRenderingDefault(false);
13 | Application.Run(new cWebpGUI());
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/dWebpGUI/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/dWebpGUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
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("dWebpGUI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("dWebpGUI")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
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 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("c5cb6412-6fd6-4027-830b-b7c573f58e68")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/dWebpGUI/Properties/Resources.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 dWebpGUI.Properties {
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", "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 | /// 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("dWebpGUI.Properties.Resources", typeof(Resources).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 |
--------------------------------------------------------------------------------
/dWebpGUI/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 |
--------------------------------------------------------------------------------
/dWebpGUI/Properties/Settings.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 dWebpGUI.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.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 | }
27 |
--------------------------------------------------------------------------------
/dWebpGUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/dWebpGUI/dWebPGUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C5CB6412-6FD6-4027-830B-B7C573F58E68}
8 | WinExe
9 | dWebpGUI
10 | dWebpGUI
11 | v4.8
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | Form
51 |
52 |
53 | dWebpGUI.cs
54 |
55 |
56 |
57 |
58 | dWebpGUI.cs
59 |
60 |
61 | ResXFileCodeGenerator
62 | Resources.Designer.cs
63 | Designer
64 |
65 |
66 | True
67 | Resources.resx
68 | True
69 |
70 |
71 | SettingsSingleFileGenerator
72 | Settings.Designer.cs
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/dWebpGUI/dWebpGUI.Designer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace dWebpGUI
4 | {
5 | partial class dWebpGUI
6 | {
7 | private System.ComponentModel.IContainer components = null;
8 |
9 | // Declaration of form controls
10 | private System.Windows.Forms.Label lblInputFile;
11 | private System.Windows.Forms.TextBox txtInputFile;
12 | private System.Windows.Forms.Label lblOutputFile;
13 | private System.Windows.Forms.TextBox txtOutputFile;
14 | private System.Windows.Forms.Button btnConvert;
15 | private System.Windows.Forms.Label lblCommandPreview;
16 | private System.Windows.Forms.TextBox txtCommandPreview;
17 | private System.Windows.Forms.CheckBox chkMultiThreading;
18 | private System.Windows.Forms.Label lblResize;
19 | private System.Windows.Forms.TextBox txtResizeWidth;
20 | private System.Windows.Forms.TextBox txtResizeHeight;
21 | private System.Windows.Forms.RadioButton rbBMP;
22 | private System.Windows.Forms.RadioButton rbTIFF;
23 | private System.Windows.Forms.RadioButton rbPAM;
24 | private System.Windows.Forms.RadioButton rbPPM;
25 | private System.Windows.Forms.RadioButton rbPGM;
26 | private System.Windows.Forms.RadioButton rbYUV;
27 | private System.Windows.Forms.GroupBox grpOutputFormat;
28 | private System.Windows.Forms.RadioButton rbPNG;
29 |
30 | protected override void Dispose(bool disposing)
31 | {
32 | if (disposing && (components != null))
33 | {
34 | components.Dispose();
35 | }
36 | base.Dispose(disposing);
37 | }
38 |
39 | private void InitializeComponent()
40 | {
41 | this.lblInputFile = new System.Windows.Forms.Label();
42 | this.txtInputFile = new System.Windows.Forms.TextBox();
43 | this.lblOutputFile = new System.Windows.Forms.Label();
44 | this.txtOutputFile = new System.Windows.Forms.TextBox();
45 | this.btnConvert = new System.Windows.Forms.Button();
46 | this.lblCommandPreview = new System.Windows.Forms.Label();
47 | this.txtCommandPreview = new System.Windows.Forms.TextBox();
48 | this.chkMultiThreading = new System.Windows.Forms.CheckBox();
49 | this.lblResize = new System.Windows.Forms.Label();
50 | this.txtResizeWidth = new System.Windows.Forms.TextBox();
51 | this.txtResizeHeight = new System.Windows.Forms.TextBox();
52 | this.rbBMP = new System.Windows.Forms.RadioButton();
53 | this.rbTIFF = new System.Windows.Forms.RadioButton();
54 | this.rbPAM = new System.Windows.Forms.RadioButton();
55 | this.rbPPM = new System.Windows.Forms.RadioButton();
56 | this.rbPGM = new System.Windows.Forms.RadioButton();
57 | this.rbYUV = new System.Windows.Forms.RadioButton();
58 | this.grpOutputFormat = new System.Windows.Forms.GroupBox();
59 | this.rbPNG = new System.Windows.Forms.RadioButton();
60 | this.grpOutputFormat.SuspendLayout();
61 | this.SuspendLayout();
62 | //
63 | // lblInputFile
64 | //
65 | this.lblInputFile.AutoSize = true;
66 | this.lblInputFile.Location = new System.Drawing.Point(18, 15);
67 | this.lblInputFile.Name = "lblInputFile";
68 | this.lblInputFile.Size = new System.Drawing.Size(53, 13);
69 | this.lblInputFile.TabIndex = 0;
70 | this.lblInputFile.Text = "Input File:";
71 | //
72 | // txtInputFile
73 | //
74 | this.txtInputFile.Location = new System.Drawing.Point(150, 12);
75 | this.txtInputFile.Name = "txtInputFile";
76 | this.txtInputFile.Size = new System.Drawing.Size(252, 20);
77 | this.txtInputFile.TabIndex = 1;
78 | this.txtInputFile.TextChanged += new System.EventHandler(this.txtInputFile_TextChanged);
79 | //
80 | // lblOutputFile
81 | //
82 | this.lblOutputFile.AutoSize = true;
83 | this.lblOutputFile.Location = new System.Drawing.Point(18, 45);
84 | this.lblOutputFile.Name = "lblOutputFile";
85 | this.lblOutputFile.Size = new System.Drawing.Size(61, 13);
86 | this.lblOutputFile.TabIndex = 2;
87 | this.lblOutputFile.Text = "Output File:";
88 | //
89 | // txtOutputFile
90 | //
91 | this.txtOutputFile.Location = new System.Drawing.Point(150, 42);
92 | this.txtOutputFile.Name = "txtOutputFile";
93 | this.txtOutputFile.Size = new System.Drawing.Size(252, 20);
94 | this.txtOutputFile.TabIndex = 3;
95 | this.txtOutputFile.TextChanged += new System.EventHandler(this.txtOutputFile_TextChanged);
96 | //
97 | // btnConvert
98 | //
99 | this.btnConvert.Location = new System.Drawing.Point(22, 350);
100 | this.btnConvert.Name = "btnConvert";
101 | this.btnConvert.Size = new System.Drawing.Size(90, 30);
102 | this.btnConvert.TabIndex = 10;
103 | this.btnConvert.Text = "Convert";
104 | this.btnConvert.UseVisualStyleBackColor = true;
105 | this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
106 | //
107 | // lblCommandPreview
108 | //
109 | this.lblCommandPreview.AutoSize = true;
110 | this.lblCommandPreview.Location = new System.Drawing.Point(18, 390);
111 | this.lblCommandPreview.Name = "lblCommandPreview";
112 | this.lblCommandPreview.Size = new System.Drawing.Size(98, 13);
113 | this.lblCommandPreview.TabIndex = 11;
114 | this.lblCommandPreview.Text = "Command Preview:";
115 | //
116 | // txtCommandPreview
117 | //
118 | this.txtCommandPreview.Location = new System.Drawing.Point(22, 410);
119 | this.txtCommandPreview.Multiline = true;
120 | this.txtCommandPreview.Name = "txtCommandPreview";
121 | this.txtCommandPreview.ReadOnly = true;
122 | this.txtCommandPreview.Size = new System.Drawing.Size(380, 100);
123 | this.txtCommandPreview.TabIndex = 12;
124 | //
125 | // chkMultiThreading
126 | //
127 | this.chkMultiThreading.AutoSize = true;
128 | this.chkMultiThreading.Location = new System.Drawing.Point(22, 70);
129 | this.chkMultiThreading.Name = "chkMultiThreading";
130 | this.chkMultiThreading.Size = new System.Drawing.Size(106, 21);
131 | this.chkMultiThreading.TabIndex = 4;
132 | this.chkMultiThreading.Text = "Multi-Threading";
133 | this.chkMultiThreading.UseVisualStyleBackColor = true;
134 | this.chkMultiThreading.CheckedChanged += new System.EventHandler(this.chkMultiThreading_CheckedChanged);
135 | //
136 | // lblResize
137 | //
138 | this.lblResize.AutoSize = true;
139 | this.lblResize.Location = new System.Drawing.Point(18, 100);
140 | this.lblResize.Name = "lblResize";
141 | this.lblResize.Size = new System.Drawing.Size(121, 13);
142 | this.lblResize.TabIndex = 5;
143 | this.lblResize.Text = "Resize (Width x Height):";
144 | //
145 | // txtResizeWidth
146 | //
147 | this.txtResizeWidth.Location = new System.Drawing.Point(150, 100);
148 | this.txtResizeWidth.Name = "txtResizeWidth";
149 | this.txtResizeWidth.Size = new System.Drawing.Size(80, 20);
150 | this.txtResizeWidth.TabIndex = 6;
151 | this.txtResizeWidth.TextChanged += new System.EventHandler(this.txtResizeWidth_TextChanged);
152 | //
153 | // txtResizeHeight
154 | //
155 | this.txtResizeHeight.Location = new System.Drawing.Point(240, 100);
156 | this.txtResizeHeight.Name = "txtResizeHeight";
157 | this.txtResizeHeight.Size = new System.Drawing.Size(80, 20);
158 | this.txtResizeHeight.TabIndex = 7;
159 | this.txtResizeHeight.TextChanged += new System.EventHandler(this.txtResizeHeight_TextChanged);
160 | //
161 | // rbBMP
162 | //
163 | this.rbBMP.AutoSize = true;
164 | this.rbBMP.Location = new System.Drawing.Point(69, 48);
165 | this.rbBMP.Name = "rbBMP";
166 | this.rbBMP.Size = new System.Drawing.Size(55, 20);
167 | this.rbBMP.TabIndex = 13;
168 | this.rbBMP.TabStop = true;
169 | this.rbBMP.Text = "BMP";
170 | this.rbBMP.UseVisualStyleBackColor = true;
171 | this.rbBMP.CheckedChanged += new System.EventHandler(this.OutputFormat_CheckedChanged);
172 | //
173 | // rbTIFF
174 | //
175 | this.rbTIFF.AutoSize = true;
176 | this.rbTIFF.Location = new System.Drawing.Point(6, 48);
177 | this.rbTIFF.Name = "rbTIFF";
178 | this.rbTIFF.Size = new System.Drawing.Size(54, 20);
179 | this.rbTIFF.TabIndex = 14;
180 | this.rbTIFF.TabStop = true;
181 | this.rbTIFF.Text = "TIFF";
182 | this.rbTIFF.UseVisualStyleBackColor = true;
183 | this.rbTIFF.CheckedChanged += new System.EventHandler(this.OutputFormat_CheckedChanged);
184 | //
185 | // rbPAM
186 | //
187 | this.rbPAM.AutoSize = true;
188 | this.rbPAM.Location = new System.Drawing.Point(6, 75);
189 | this.rbPAM.Name = "rbPAM";
190 | this.rbPAM.Size = new System.Drawing.Size(55, 20);
191 | this.rbPAM.TabIndex = 15;
192 | this.rbPAM.TabStop = true;
193 | this.rbPAM.Text = "PAM";
194 | this.rbPAM.UseVisualStyleBackColor = true;
195 | this.rbPAM.CheckedChanged += new System.EventHandler(this.OutputFormat_CheckedChanged);
196 | //
197 | // rbPPM
198 | //
199 | this.rbPPM.AutoSize = true;
200 | this.rbPPM.Location = new System.Drawing.Point(6, 102);
201 | this.rbPPM.Name = "rbPPM";
202 | this.rbPPM.Size = new System.Drawing.Size(55, 20);
203 | this.rbPPM.TabIndex = 16;
204 | this.rbPPM.TabStop = true;
205 | this.rbPPM.Text = "PPM";
206 | this.rbPPM.UseVisualStyleBackColor = true;
207 | this.rbPPM.CheckedChanged += new System.EventHandler(this.OutputFormat_CheckedChanged);
208 | //
209 | // rbPGM
210 | //
211 | this.rbPGM.AutoSize = true;
212 | this.rbPGM.Location = new System.Drawing.Point(6, 129);
213 | this.rbPGM.Name = "rbPGM";
214 | this.rbPGM.Size = new System.Drawing.Size(56, 20);
215 | this.rbPGM.TabIndex = 17;
216 | this.rbPGM.TabStop = true;
217 | this.rbPGM.Text = "PGM";
218 | this.rbPGM.UseVisualStyleBackColor = true;
219 | this.rbPGM.CheckedChanged += new System.EventHandler(this.OutputFormat_CheckedChanged);
220 | //
221 | // rbYUV
222 | //
223 | this.rbYUV.AutoSize = true;
224 | this.rbYUV.Location = new System.Drawing.Point(70, 21);
225 | this.rbYUV.Name = "rbYUV";
226 | this.rbYUV.Size = new System.Drawing.Size(54, 20);
227 | this.rbYUV.TabIndex = 18;
228 | this.rbYUV.TabStop = true;
229 | this.rbYUV.Text = "YUV";
230 | this.rbYUV.UseVisualStyleBackColor = true;
231 | this.rbYUV.CheckedChanged += new System.EventHandler(this.OutputFormat_CheckedChanged);
232 | //
233 | // grpOutputFormat
234 | //
235 | this.grpOutputFormat.Controls.Add(this.rbBMP);
236 | this.grpOutputFormat.Controls.Add(this.rbTIFF);
237 | this.grpOutputFormat.Controls.Add(this.rbPAM);
238 | this.grpOutputFormat.Controls.Add(this.rbPPM);
239 | this.grpOutputFormat.Controls.Add(this.rbPGM);
240 | this.grpOutputFormat.Controls.Add(this.rbYUV);
241 | this.grpOutputFormat.Controls.Add(this.rbPNG);
242 | this.grpOutputFormat.Location = new System.Drawing.Point(22, 140);
243 | this.grpOutputFormat.Name = "grpOutputFormat";
244 | this.grpOutputFormat.Size = new System.Drawing.Size(380, 150);
245 | this.grpOutputFormat.TabIndex = 9;
246 | this.grpOutputFormat.TabStop = false;
247 | this.grpOutputFormat.Text = "Output Format";
248 | //
249 | // rbPNG
250 | //
251 | this.rbPNG.AutoSize = true;
252 | this.rbPNG.Checked = true;
253 | this.rbPNG.Location = new System.Drawing.Point(6, 21);
254 | this.rbPNG.Name = "rbPNG";
255 | this.rbPNG.Size = new System.Drawing.Size(55, 20);
256 | this.rbPNG.TabIndex = 19;
257 | this.rbPNG.TabStop = true;
258 | this.rbPNG.Text = "PNG";
259 | this.rbPNG.UseVisualStyleBackColor = true;
260 | this.rbPNG.CheckedChanged += new System.EventHandler(this.OutputFormat_CheckedChanged);
261 | //
262 | // Form1
263 | //
264 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
265 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
266 | this.ClientSize = new System.Drawing.Size(424, 521);
267 | this.Controls.Add(this.grpOutputFormat);
268 | this.Controls.Add(this.txtResizeHeight);
269 | this.Controls.Add(this.txtResizeWidth);
270 | this.Controls.Add(this.lblResize);
271 | this.Controls.Add(this.chkMultiThreading);
272 | this.Controls.Add(this.txtCommandPreview);
273 | this.Controls.Add(this.lblCommandPreview);
274 | this.Controls.Add(this.btnConvert);
275 | this.Controls.Add(this.txtOutputFile);
276 | this.Controls.Add(this.lblOutputFile);
277 | this.Controls.Add(this.txtInputFile);
278 | this.Controls.Add(this.lblInputFile);
279 | this.Name = "Form1";
280 | this.Text = "DWebP GUI";
281 | this.grpOutputFormat.ResumeLayout(false);
282 | this.grpOutputFormat.PerformLayout();
283 | this.ResumeLayout(false);
284 | this.PerformLayout();
285 |
286 | }
287 | }
288 | }
289 |
--------------------------------------------------------------------------------
/dWebpGUI/dWebpGUI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Windows.Forms;
5 |
6 | namespace dWebpGUI
7 | {
8 | public partial class dWebpGUI : Form
9 | {
10 | public dWebpGUI()
11 | {
12 | InitializeComponent();
13 | UpdateCommandPreview();
14 | }
15 |
16 | private void btnConvert_Click(object sender, EventArgs e)
17 | {
18 | string inputFile = txtInputFile.Text;
19 | string outputFile = txtOutputFile.Text;
20 | string options = BuildOptions();
21 |
22 | inputFile = inputFile.Trim('"');
23 |
24 | if (File.Exists(inputFile))
25 | {
26 | if (string.IsNullOrWhiteSpace(outputFile))
27 | {
28 | string directory = Path.GetDirectoryName(inputFile);
29 | string filenameWithoutExtension = Path.GetFileNameWithoutExtension(inputFile);
30 | outputFile = Path.Combine(directory, filenameWithoutExtension + GetOutputExtension());
31 | }
32 | else
33 | {
34 | outputFile = outputFile.Trim('"');
35 | outputFile = Path.Combine(Path.GetDirectoryName(inputFile), outputFile);
36 | }
37 |
38 | string command = $"dwebp {options} \"{inputFile}\" -o \"{outputFile}\"";
39 | RunCommand(command);
40 | }
41 | else
42 | {
43 | MessageBox.Show("Input file does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
44 | }
45 | }
46 |
47 | private string BuildOptions()
48 | {
49 | string options = "";
50 |
51 | if (chkMultiThreading.Checked)
52 | options += " -mt";
53 |
54 | if (!string.IsNullOrWhiteSpace(txtResizeWidth.Text) && !string.IsNullOrWhiteSpace(txtResizeHeight.Text))
55 | options += $" -resize {txtResizeWidth.Text} {txtResizeHeight.Text}";
56 |
57 | // Check which radio button is selected and append the corresponding option
58 | if (rbBMP.Checked)
59 | options += " -bmp";
60 | else if (rbTIFF.Checked)
61 | options += " -tiff";
62 | else if (rbPAM.Checked)
63 | options += " -pam";
64 | else if (rbPPM.Checked)
65 | options += " -ppm";
66 | else if (rbPGM.Checked)
67 | options += " -pgm";
68 | else if (rbYUV.Checked)
69 | options += " -yuv";
70 | // No need to append anything for PNG as it's the default format
71 |
72 | return options;
73 | }
74 |
75 | private string GetOutputExtension()
76 | {
77 | if (rbBMP.Checked) return ".bmp";
78 | if (rbTIFF.Checked) return ".tiff";
79 | if (rbPAM.Checked) return ".pam";
80 | if (rbPPM.Checked) return ".ppm";
81 | if (rbPGM.Checked) return ".pgm";
82 | if (rbYUV.Checked) return ".yuv";
83 | return ".png"; // default to PNG if no option is selected or PNG is selected
84 | }
85 |
86 | private void RunCommand(string command)
87 | {
88 | ProcessStartInfo processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
89 | processInfo.CreateNoWindow = true;
90 | processInfo.UseShellExecute = false;
91 | processInfo.RedirectStandardError = true;
92 | processInfo.RedirectStandardOutput = true;
93 |
94 | Process process = new Process();
95 | process.StartInfo = processInfo;
96 | process.Start();
97 |
98 | string output = process.StandardOutput.ReadToEnd();
99 | string error = process.StandardError.ReadToEnd();
100 |
101 | process.WaitForExit();
102 |
103 | // Check if the error output contains the word "Error"
104 | if (!string.IsNullOrEmpty(error) && error.ToLowerInvariant().Contains("error"))
105 | {
106 | MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
107 | }
108 | else if (!string.IsNullOrEmpty(output))
109 | {
110 | MessageBox.Show(output, "Output", MessageBoxButtons.OK, MessageBoxIcon.Information);
111 | }
112 | else if (!string.IsNullOrEmpty(error)) // Handle non-error but stderr output case
113 | {
114 | MessageBox.Show(error, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
115 | }
116 | }
117 |
118 | private void UpdateCommandPreview()
119 | {
120 | string inputFile = txtInputFile.Text;
121 | string outputFile = txtOutputFile.Text;
122 | string options = BuildOptions();
123 |
124 | inputFile = inputFile.Trim('"');
125 |
126 | if (string.IsNullOrWhiteSpace(outputFile))
127 | {
128 | if (!string.IsNullOrWhiteSpace(inputFile))
129 | {
130 | string directory = Path.GetDirectoryName(inputFile);
131 | string filenameWithoutExtension = Path.GetFileNameWithoutExtension(inputFile);
132 | outputFile = Path.Combine(directory, filenameWithoutExtension + GetOutputExtension());
133 | }
134 | }
135 | else
136 | {
137 | outputFile = outputFile.Trim('"');
138 | outputFile = Path.Combine(Path.GetDirectoryName(inputFile), outputFile);
139 | }
140 |
141 | string command = $"dwebp {options} \"{inputFile}\" -o \"{outputFile}\"";
142 | txtCommandPreview.Text = command;
143 | }
144 |
145 | private void txtInputFile_TextChanged(object sender, EventArgs e)
146 | {
147 | UpdateCommandPreview();
148 | }
149 |
150 | private void txtOutputFile_TextChanged(object sender, EventArgs e)
151 | {
152 | UpdateCommandPreview();
153 | }
154 |
155 | private void chkMultiThreading_CheckedChanged(object sender, EventArgs e)
156 | {
157 | UpdateCommandPreview();
158 | }
159 |
160 | private void OutputFormat_CheckedChanged(object sender, EventArgs e)
161 | {
162 | UpdateCommandPreview();
163 | }
164 |
165 | private void txtResizeWidth_TextChanged(object sender, EventArgs e)
166 | {
167 | UpdateCommandPreview();
168 | }
169 |
170 | private void txtResizeHeight_TextChanged(object sender, EventArgs e)
171 | {
172 | UpdateCommandPreview();
173 | }
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/dWebpGUI/dWebpGUI.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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/dWebpGUI/dWebpProgram.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace dWebpGUI
5 | {
6 | static class Program
7 | {
8 | [STAThread]
9 | static void Main()
10 | {
11 | Application.EnableVisualStyles();
12 | Application.SetCompatibleTextRenderingDefault(false);
13 | Application.Run(new dWebpGUI());
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------