Skip to content

Commit

Permalink
Update mozjpeg to 4.0.0, clean up file paths, add missing copying.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
markgibbons25 committed Nov 14, 2020
1 parent 5039b1b commit 7ff4e12
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public MozJpegOptimizerTests(ITestOutputHelper output)
public void ShouldSquishSmallJpegLossless()
{
Test(@"TestImages\small.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg_3.3.1_x86\jpegtran.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg\jpegtran.exe",
"-progressive", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -31,7 +31,7 @@ public void ShouldSquishSmallJpegLossless()
public void ShouldSquishLargeJpegLossless()
{
Test(@"TestImages\large.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg_3.3.1_x86\jpegtran.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg\jpegtran.exe",
"-progressive", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -41,7 +41,7 @@ public void ShouldSquishLargeJpegLossless()
public void ShouldSquishSmallJpegLossy()
{
Test(@"TestImages\small.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg_3.3.1_x86\cjpeg.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg\cjpeg.exe",
"-quality 80", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -51,7 +51,7 @@ public void ShouldSquishSmallJpegLossy()
public void ShouldSquishLargeJpegLossy()
{
Test(@"TestImages\large.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg_3.3.1_x86\cjpeg.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg\cjpeg.exe",
"-quality 80", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -61,7 +61,7 @@ public void ShouldSquishLargeJpegLossy()
public void ShouldNotSquishCorruptedJpegLossless()
{
Test(@"TestImages\corrupted.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg_3.3.1_x86\jpegtran.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg\jpegtran.exe",
"-quality 80", out var args, out var startingSize);
args.Stream.Length.Should().IsSameOrEqualTo(startingSize);
args.IsOptimized.Should().BeFalse();
Expand All @@ -71,7 +71,7 @@ public void ShouldNotSquishCorruptedJpegLossless()
public void ShouldNotSquishCorruptedJpegLossy()
{
Test(@"TestImages\corrupted.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg_3.3.1_x86\cjpeg.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\mozjpeg\cjpeg.exe",
"-quality 80", out var args, out var startingSize);
args.Stream.Length.Should().IsSameOrEqualTo(startingSize);
args.IsOptimized.Should().BeFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public WebPOptimizerTests(ITestOutputHelper output)
public void ShouldReturnOriginalStreamWhenOptimizedImageSizeIsGreater()
{
Test(@"TestImages\small.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-q 100 -m 6 -lossless", out var args, out var startingSize);
args.Stream.Length.Should().Be(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeFalse();
Expand All @@ -31,7 +31,7 @@ public void ShouldReturnOriginalStreamWhenOptimizedImageSizeIsGreater()
public void ShouldSquishLosslessSmallPng()
{
Test(@"TestImages\small.png",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-q 100 -m 6 -lossless", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -41,7 +41,7 @@ public void ShouldSquishLosslessSmallPng()
public void ShouldSquishLosslessLargePng()
{
Test(@"TestImages\large.png",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-q 100 -m 6 -lossless", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -51,7 +51,7 @@ public void ShouldSquishLosslessLargePng()
public void ShouldSquishLossyTestJpeg()
{
Test(@"TestImages\large.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-q 90 -m 6", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -61,7 +61,7 @@ public void ShouldSquishLossyTestJpeg()
public void ShouldSquishLossySmallJpegDefaults()
{
Test(@"TestImages\small.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-preset photo -q 80", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -71,7 +71,7 @@ public void ShouldSquishLossySmallJpegDefaults()
public void ShouldSquishLossyLargeJpegDefaults()
{
Test(@"TestImages\small.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-preset photo -q 80", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -81,7 +81,7 @@ public void ShouldSquishLossyLargeJpegDefaults()
public void ShouldNotSquishCorruptedJpegLossy()
{
Test(@"TestImages\corrupted.jpg",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-preset photo -q 80", out var args, out var startingSize);
args.Stream.Length.Should().IsSameOrEqualTo(startingSize);
args.IsOptimized.Should().BeFalse();
Expand All @@ -91,7 +91,7 @@ public void ShouldNotSquishCorruptedJpegLossy()
public void ShouldSquishLossySmallPngHighAlpha()
{
Test(@"TestImages\small.png",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-q 90 -alpha_q 100 -m 6", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -101,7 +101,7 @@ public void ShouldSquishLossySmallPngHighAlpha()
public void ShouldSquishLossySmallPngDefaults()
{
Test(@"TestImages\small.png",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-preset icon", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -111,7 +111,7 @@ public void ShouldSquishLossySmallPngDefaults()
public void ShouldSquishLossyLargePngDefaults()
{
Test(@"TestImages\large.png",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\cwebp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\cwebp.exe",
"-preset icon", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -121,7 +121,7 @@ public void ShouldSquishLossyLargePngDefaults()
public void ShouldSquishLossyTestGif()
{
Test(@"TestImages\small.gif",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\gif2webp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\gif2webp.exe",
"-q 90 -lossy", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand All @@ -131,7 +131,7 @@ public void ShouldSquishLossyTestGif()
public void ShouldSquishLosslessTestGif()
{
Test(@"TestImages\small.gif",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp-1.1.0-windows-x64\bin\gif2webp.exe",
@"..\..\..\..\Dianoga\Dianoga Tools\libwebp\gif2webp.exe",
"-q 80", out var args, out var startingSize);
args.Stream.Length.Should().BeLessThan(startingSize).And.BeGreaterThan(0);
args.IsOptimized.Should().BeTrue();
Expand Down
4 changes: 2 additions & 2 deletions src/Dianoga/Default Config Files/Dianoga.Jpeg.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<dianogaOptimizeJpeg>
<!-- mozjpeg lossless compression
<processor type="Dianoga.Optimizers.Pipelines.DianogaJpeg.MozJpegOptimizer, Dianoga">
<ExePath>/App_Data/Dianoga Tools/mozjpeg_3.3.1_x86/jpegtran.exe</ExePath>
<ExePath>/App_Data/Dianoga Tools/mozjpeg/jpegtran.exe</ExePath>
<AdditionalToolArguments>-optimize -copy none -progressive</AdditionalToolArguments>
</processor> -->
<!-- mozjpeg lossy compression, quality set to 80%, progressive by default -->
<processor type="Dianoga.Optimizers.Pipelines.DianogaJpeg.MozJpegOptimizer, Dianoga">
<ExePath>/App_Data/Dianoga Tools/mozjpeg_3.3.1_x86/cjpeg.exe</ExePath>
<ExePath>/App_Data/Dianoga Tools/mozjpeg/cjpeg.exe</ExePath>
<AdditionalToolArguments>-quality 80</AdditionalToolArguments>
</processor>
</dianogaOptimizeJpeg>
Expand Down
8 changes: 4 additions & 4 deletions src/Dianoga/Default Config Files/Dianoga.WebP.config.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@

<dianogaOptimizeWebP>
<processor type="Dianoga.Optimizers.Pipelines.DianogaWebP.WebPOptimizer, Dianoga">
<ExePath>/App_Data/Dianoga Tools/libwebp-1.1.0-windows-x64/bin/cwebp.exe</ExePath>
<ExePath>/App_Data/Dianoga Tools/libwebp/cwebp.exe</ExePath>
<AdditionalToolArguments>-q 80</AdditionalToolArguments>
</processor>
</dianogaOptimizeWebP>
<dianogaOptimizeJpeg>
<processor type="Dianoga.Optimizers.Pipelines.DianogaWebP.WebPOptimizer, Dianoga" patch:before="processor[1]">
<ExePath>/App_Data/Dianoga Tools/libwebp-1.1.0-windows-x64/bin/cwebp.exe</ExePath>
<ExePath>/App_Data/Dianoga Tools/libwebp/cwebp.exe</ExePath>
<AdditionalToolArguments>-preset photo -q 80</AdditionalToolArguments>
</processor>
</dianogaOptimizeJpeg>
<dianogaOptimizePng>
<processor type="Dianoga.Optimizers.Pipelines.DianogaWebP.WebPOptimizer, Dianoga" patch:before="processor[1]">
<ExePath>/App_Data/Dianoga Tools/libwebp-1.1.0-windows-x64/bin/cwebp.exe</ExePath>
<ExePath>/App_Data/Dianoga Tools/libwebp/cwebp.exe</ExePath>
<AdditionalToolArguments>-preset icon</AdditionalToolArguments>
</processor>
</dianogaOptimizePng>
<dianogaOptimizeGif>
<processor type="Dianoga.Optimizers.Pipelines.DianogaWebP.WebPOptimizer, Dianoga" patch:before="processor[1]">
<ExePath>/App_Data/Dianoga Tools/libwebp-1.1.0-windows-x64/bin/gif2webp.exe</ExePath>
<ExePath>/App_Data/Dianoga Tools/libwebp/gif2webp.exe</ExePath>
<AdditionalToolArguments>-q 80 -lossy</AdditionalToolArguments>
<DisableResizing>true</DisableResizing>
</processor>
Expand Down
55 changes: 55 additions & 0 deletions src/Dianoga/Dianoga Tools/SVGO/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
The MIT License

Copyright © 2012–2016 Kir Belevich

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Лицензия MIT

Copyright © 2012–2016 Кир Белевич

Данная лицензия разрешает лицам, получившим копию данного
программного обеспечения и сопутствующей документации
(в дальнейшем именуемыми «Программное Обеспечение»), безвозмездно
использовать Программное Обеспечение без ограничений, включая
неограниченное право на использование, копирование, изменение,
добавление, публикацию, распространение, сублицензирование
и/или продажу копий Программного Обеспечения, также как и лицам,
которым предоставляется данное Программное Обеспечение,
при соблюдении следующих условий:

Указанное выше уведомление об авторском праве и данные условия
должны быть включены во все копии или значимые части данного
Программного Обеспечения.

ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ»,
БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ,
ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ,
СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ
ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ
ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ
ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ,
ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ
ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ
ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ.
30 changes: 30 additions & 0 deletions src/Dianoga/Dianoga Tools/libwebp/COPYING.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2010, Google Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.

* Neither the name of Google nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File renamed without changes.
Binary file added src/Dianoga/Dianoga Tools/mozjpeg/cjpeg.exe
Binary file not shown.
Binary file added src/Dianoga/Dianoga Tools/mozjpeg/jpegtran.exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion src/Dianoga/Dianoga.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net452;net462;net471;net48</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>Automatic media library image file optimization for Sitecore</Description>
<Version>5.0.3</Version>
<Version>5.1.0</Version>
<Authors>Kam Figy, Mark Gibbons</Authors>
<PackageProjectUrl>https://github.com/kamsar/Dianoga</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down Expand Up @@ -81,5 +81,6 @@
</ItemGroup>
<ItemGroup>
<None Remove="Default Config Files\Dianoga.WebP.CDN.config.disabled" />
<None Remove="Dianoga Tools\libwebp\COPYING.txt" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Dianoga/Dianoga.svgtools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package>
<metadata>
<id>Dianoga.svgtools</id>
<version>5.0.3</version>
<version>5.1.0</version>
<title>Dianoga.svgtools</title>
<authors>Kam Figy, Mark Gibbons</authors>
<owners>Kam Figy, Mark Gibbons</owners>
Expand All @@ -14,7 +14,7 @@
<copyright>Copyright 2020</copyright>
<tags>sitecore image optimization</tags>
<dependencies>
<dependency id="Dianoga" version="5.0.3" />
<dependency id="Dianoga" version="5.1.0" />
</dependencies>
</metadata>
<files>
Expand Down

0 comments on commit 7ff4e12

Please sign in to comment.