mirror of https://github.com/SixLabors/ImageSharp
2 changed files with 33 additions and 40 deletions
@ -0,0 +1,33 @@ |
|||
// <copyright file="EntropyCropTest.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Tests.Processing.Transforms |
|||
{ |
|||
using ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
|
|||
public class EntropyCropTest : FileTestBase |
|||
{ |
|||
public static readonly TheoryData<float> EntropyCropValues |
|||
= new TheoryData<float> |
|||
{ |
|||
.25F, |
|||
.75F |
|||
}; |
|||
|
|||
[Theory] |
|||
[WithFileCollection(nameof(DefaultFiles), nameof(EntropyCropValues), StandardPixelType)] |
|||
public void ImageShouldEntropyCrop<TPixel>(TestImageProvider<TPixel> provider, float value) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (Image<TPixel> image = provider.GetImage()) |
|||
{ |
|||
image.EntropyCrop(value) |
|||
.DebugSave(provider, value, Extensions.Bmp); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,40 +0,0 @@ |
|||
// <copyright file="EntropyCropTest.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Tests |
|||
{ |
|||
using System.IO; |
|||
|
|||
using ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
|
|||
public class EntropyCropTest : FileTestBase |
|||
{ |
|||
public static readonly TheoryData<float> EntropyCropValues |
|||
= new TheoryData<float> |
|||
{ |
|||
.25f , |
|||
.75f , |
|||
}; |
|||
|
|||
[Theory] |
|||
[MemberData(nameof(EntropyCropValues))] |
|||
public void ImageShouldApplyEntropyCropSampler(float value) |
|||
{ |
|||
string path = this.CreateOutputDirectory("EntropyCrop"); |
|||
|
|||
foreach (TestFile file in Files) |
|||
{ |
|||
string filename = file.GetFileName(value); |
|||
using (Image<Rgba32> image = file.CreateImage()) |
|||
using (FileStream output = File.OpenWrite($"{path}/{filename}")) |
|||
{ |
|||
image.EntropyCrop(value).Save(output); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue