Skip to content

Images 2 pixels wide can not be resized #1195

@AlexDenton

Description

@AlexDenton

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

When trying to resize an image that's 2px wide or less a ArgumentOutOfRangeException is thrown with the message: Parameter "width" (System.Int32) must be greater than 0, was 0.

This happens at 1 pixels and 2 pixels, but not 3 pixels. Practically speaking this probably won't matter in most scenarios but I thought I'd let you guys know.

Steps to Reproduce

This code snippet will repro:

var memoryStream = new MemoryStream(File.ReadAllBytes("player-min-px.jpg"));
using (var image = Image.Load(memoryStream))
{
    var size = new Size(50, 50);
    image.Mutate(x => x
        .Resize(
            new ResizeOptions
            {
                Size = size,
                Mode = ResizeMode.Max
            }));
}

System Configuration

  • ImageSharp version: 1.0.0-rc0001
  • Environment (Operating system, version and so on): Windows 10
  • .NET Framework version: Dotnet Core 2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions