Skip to content

Commit 9f7e411

Browse files
Best png compression so far
1 parent 0dfa96f commit 9f7e411

File tree

9 files changed

+25
-6
lines changed

9 files changed

+25
-6
lines changed

src/ImageOptimizer.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@
160160
<Content Include="Resources\Tools\pngquant.exe">
161161
<IncludeInVSIX>true</IncludeInVSIX>
162162
</Content>
163+
<Content Include="Resources\Tools\TruePNG.exe">
164+
<IncludeInVSIX>true</IncludeInVSIX>
165+
</Content>
163166
<Content Include="Resources\Tools\zopfli.exe">
164167
<IncludeInVSIX>true</IncludeInVSIX>
165168
</Content>

src/Resources/Tools/TruePNG.exe

296 KB
Binary file not shown.

src/Resources/Tools/advdef.exe

884 KB
Binary file not shown.

src/Resources/Tools/advpng.exe

869 KB
Binary file not shown.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
::optipng %1 -out %2 -o5 -i0
22
::pngout %1 %2 /s0 /y /kpHYs
33
::pngzopfli %1 10 %2
4-
zopflipng %1 %2
4+
truepng /o4 %1 /out %2
5+
zopflipng --ohh %2 %2.png
6+
copy %2.png %2 /y
7+
del %2.png

src/Resources/Tools/png-lossy.cmd

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
pngquant --speed 1 %1 --output %2
1+
pngquant --speed 1 --skip-if-larger %1 --output %2
2+
23
::optipng %2 -out %2 -o3 -i0
4+
::pngout %2 %2 /s0 /y /kpHYs
5+
if not exist %2 copy %1 %2
6+
7+
truepng /o4 %2
38
pngout %2 %2 /s0 /y /kpHYs
4-
::zopflipng %2
9+
zopflipng --ohh %2 %2.png
10+
11+
copy %2.png %2 /y
12+
del %2.png
13+
14+
15+
::advpng --recompress %2
16+
::advdef -z -4 %2
73.9 KB
Loading

test/ImageOptimizer.Test/ImageOptimizer.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<Content Include="Artifacts\jpg\lake.jpg" />
7777
<Content Include="Artifacts\png\AddClass.png" />
7878
<Content Include="Artifacts\png\Bower.png" />
79+
<Content Include="Artifacts\png\ducati.png" />
7980
<Content Include="Artifacts\png\grunt.png" />
8081
<Content Include="Artifacts\png\logo.png" />
8182
<Content Include="Artifacts\png\screenshot.png" />

test/ImageOptimizer.Test/Test.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ public void Png_LossLess()
4444
{
4545
long savings = ExecuteTest("*.png", false);
4646

47-
Assert.IsTrue(savings == 28619, "Don't compress enough");
47+
Assert.IsTrue(savings == 28855, "Don't compress enough");
4848
}
4949

5050
[TestMethod, TestCategory("PNG")]
5151
public void Png_Lossy()
5252
{
5353
long savings = ExecuteTest("*.png", true);
5454

55-
Assert.IsTrue(savings == 78181, "Don't compress enough");
55+
Assert.IsTrue(savings == 135289, "Don't compress enough");
5656
}
5757

5858
[TestMethod, TestCategory("GIF")]
@@ -100,7 +100,7 @@ private long RunCompression(string searchFilter, bool lossy)
100100

101101
foreach (var group in grouped)
102102
{
103-
var sum = group.Sum(g => g.Saving);
103+
var sum = group.Sum(g => g.Saving);
104104
var time = group.Average(g => g.Elapsed.TotalSeconds);
105105
total += sum;
106106
sb.AppendLine(group.Key + "\t" + group.Count() + "\t" + sum + "\t" + Math.Round(time, 2));

0 commit comments

Comments
 (0)