Browse Source

EntropyCrop

af/merge-core
James Jackson-South 9 years ago
parent
commit
0a8eeedb5f
  1. 33
      tests/ImageSharp.Tests/Processing/Transforms/EntropyCropTest.cs
  2. 40
      tests/ImageSharp.Tests/Processors/Filters/EntropyCropTest.cs

33
tests/ImageSharp.Tests/Processing/Transforms/EntropyCropTest.cs

@ -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);
}
}
}
}

40
tests/ImageSharp.Tests/Processors/Filters/EntropyCropTest.cs

@ -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…
Cancel
Save