Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rowSpan after Image.Load<Bgr24>(filename.bmp) fails on Linux, same image file + code work on Windows #305

Closed
4 tasks done
ghost opened this issue Aug 23, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Aug 23, 2017

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

For me the unit test below works for Windows, but fails for Linux.
When i change "Image.Load<Bgr24>(sourceFilePath)" to Image.Load(sourceFilePath) it works for both.

Steps to Reproduce

    [Theory]
    [InlineData("TestData/Screens/white.bmp", 255)]
    public void DummyTest(string sourceFilePath, byte expected_rgb)
    {
        using (var image = Image.Load<Bgr24>(sourceFilePath))
        {
            for (int y = 0; y < image.Height; y++)
            {
                var rowSpan = image.GetRowSpan(y);
                for (int x = 0; x < image.Width; x++)
                {
                    if (expected_rgb != rowSpan[x].R ||
                        expected_rgb != rowSpan[x].G ||
                        expected_rgb != rowSpan[x].B)
                    {
                        output.WriteLine(string.Format("failed at y={0} x={1}", y, x));
                        output.WriteLine(string.Format("r={0} g={1} b={2}", rowSpan[x].R, rowSpan[x].G, rowSpan[x].B));
                    }

                    Assert.Equal(expected_rgb, rowSpan[x].R);
                    Assert.Equal(expected_rgb, rowSpan[x].G);
                    Assert.Equal(expected_rgb, rowSpan[x].B);
                }
            }
        }
    }

System Configuration

  • Linux: Ubuntu-Server 14.04.1 LTS Trusty Tahr (3.13.0-85-generic #129-Ubuntu SMP Thu Mar 17 20:50:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux)

  • Windows: Windwos 10 64bit

  • ImageSharp version: ImageSharp 1.0.0-alpha9-00182

  • Other ImageSharp packages and versions:

  • Environment (Operating system, version and so on):

  • .NET Framework version: .Net Core 2.0, failed with .Net Core 1.1 as well

  • Additional information:

white.zip

@ghost
Copy link
Author

ghost commented Nov 16, 2017

GetRowSpan is no longer part of the public API, so this issue makes no longer sense

@ghost ghost closed this as completed Nov 16, 2017
@JimBobSquarePants
Copy link
Member

It will most likely be for v1 though so I'd like to keep it open and see if anything has changed by then.

@antonfirsov
Copy link
Member

antonfirsov commented Nov 16, 2017

@pammann-work Is this about assertions failing (and not Span-related exceptions and crashes) right?
Can you do a favor for us, and try changing your test to use the image[x, y] indexer instead of row span? :)

If my assumptions are right right, this has nothing to do with Span<T>. It is a strange pixel-type conversion issue we experience on Linux. I'm quite sure we already had an open issue for this, but I was unable to find it. @JimBobSquarePants @dlemstra do you remember which one is it?

@antonfirsov
Copy link
Member

antonfirsov commented Nov 16, 2017

Wait ... I just realized this issue has been opened in August. So .. this is the issue I was talking about. I need more cofee.

@antonfirsov
Copy link
Member

This has been most likely fixed by #591 (possible duplicate of #576).

We plan to expose .GetRowSpan() again soon (see #565)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants