镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

NearestNeighbor fails to resize with Crop Mode. #1342

Closed

Description

@JimBobSquarePants

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

We're getting out of bounds exceptions when resizing with nearest neighbor. All other resamplers using the worker pipeline are fine.

I have a fix, which I will push soon. We were not using the interest working bounds properly.

Steps to Reproduce

[Theory]
[InlineData(1, 1)]
[InlineData(4, 6)]
[InlineData(2, 10)]
[InlineData(8, 1)]
[InlineData(3, 7)]
public void CanResizeNearestNeigbour(int width, int height)
{
    using (var image = new Image<Rgba32>(1, 1))
    {
        var size = new Size(width, height);
        image.Mutate(x => x
            .Resize(
                new ResizeOptions
                {
                    Size = size,
                    Sampler = KnownResamplers.NearestNeighbor
                }));

        Assert.Equal(width, image.Width);
        Assert.Equal(height, image.Height);
    }
}

System Configuration

  • ImageSharp version: v1.0.1
  • Other ImageSharp packages and versions: NA
  • Environment (Operating system, version and so on): ALL
  • .NET Framework version: ALL
  • Additional information: NA

Activity

  1. added a commit that references this issue on Sep 4, 2020
    6c41d2f
  2. added this to the milestone on Sep 4, 2020
  3. added a commit that references this issue on Sep 4, 2020
    b06cb32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions