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

Image.Load<Rgba32> does not respect PreferContiguousImageBuffers #1983

Closed
4 tasks done
roeyskoe opened this issue Feb 8, 2022 · 0 comments · Fixed by #1999
Closed
4 tasks done

Image.Load<Rgba32> does not respect PreferContiguousImageBuffers #1983

roeyskoe opened this issue Feb 8, 2022 · 0 comments · Fixed by #1999
Labels
Milestone

Comments

@roeyskoe
Copy link

roeyskoe commented Feb 8, 2022

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

Following this sample: https://docs.sixlabors.com/articles/imagesharp/memorymanagement.html#enforcing-contiguous-buffers
but instead loading an image file

using (Image<Rgba32> image = Image.Load<Rgba32>(customConfig, "big.png"))

will result in discontigous memory being used.

This is probably caused by https://github.com/SixLabors/ImageSharp/blob/master/src/ImageSharp/Image.Decode.cs#L41
not passing configuration.PreferContiguousImageBuffers to Allocate2D. Adding this extra parameter fixes the issue on my use case.

I did not open a PR for that, since I am not familiar with ImageSharps internal workings and am not sure if this issue also exists elsewhere.

Steps to Reproduce

https://github.com/roeyskoe/ImageSharpContiguous

System Configuration

  • ImageSharp version: 2.0.0 (also when using latest source)
  • Other ImageSharp packages and versions: -
  • Environment (Operating system, version and so on): Windows 10 x64 10.0.19044
  • .NET Framework version: .NET 6
  • Additional information:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants