Skip to content

PlatformNotSupportedException thrown when resizing an image on Ubuntu #1546

@QuantumToasted

Description

@QuantumToasted

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 attempting to call the IImageProcessingContext#Resize() extension method, the following exception is thrown:

SixLabors.ImageSharp.ImageProcessingException: An error occurred when processing the image using ResizeProcessor`1. See the inner exception for more detail.
 ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
   at System.Runtime.Intrinsics.X86.Avx2.PermuteVar8x32(Vector256`1 left, Vector256`1 control)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeWorker`1.CalculateFirstPassValues(RowInterval calculationInterval)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeWorker`1.Initialize()
   at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.ApplyResizeFrameTransform(Configuration configuration, ImageFrame`1 source, ImageFrame`1 destination, ResizeKernelMap horizontalKernelMap, ResizeKernelMap verticalKernelMap, Rectangle sourceRectangle, Rectangle destinationRectangle, Rectangle interest, Boolean compand, Boolean premultiplyAlpha)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.ApplyTransform[TResampler](TResampler& sampler)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.SixLabors.ImageSharp.Processing.Processors.Transforms.IResamplingTransformImageProcessor<TPixel>.ApplyTransform[TResampler](TResampler& sampler)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor`1.BeforeImageApply(Image`1 destination)
   at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.SixLabors.ImageSharp.Processing.Processors.ICloningImageProcessor<TPixel>.CloneAndExecute()
   --- End of inner exception stack trace ---
   at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.SixLabors.ImageSharp.Processing.Processors.ICloningImageProcessor<TPixel>.CloneAndExecute()
   at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.SixLabors.ImageSharp.Processing.Processors.IImageProcessor<TPixel>.Execute()
   at SixLabors.ImageSharp.Processing.DefaultImageProcessorContext`1.ApplyProcessor(IImageProcessor processor, Rectangle rectangle)
   at SixLabors.ImageSharp.Processing.DefaultImageProcessorContext`1.ApplyProcessor(IImageProcessor processor)
   at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, ResizeOptions options)
   at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, Int32 width, Int32 height, IResampler sampler, Rectangle targetRectangle, Boolean compand)
   at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, Int32 width, Int32 height, IResampler sampler, Boolean compand)
   at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, Int32 width, Int32 height)
   at Administrator.Services.LevelService.<>c__DisplayClass6_1.<CreateXpImageAsync>b__5(IImageProcessingContext x) in C:\Users\Daniel Jarski\source\repos\Administrator\Administrator\Services\LevelService.cs:line 102
   at SixLabors.ImageSharp.Processing.ProcessingExtensions.Mutate[TPixel](Image`1 source, Configuration configuration, Action`1 operation)
   at SixLabors.ImageSharp.Processing.ProcessingExtensions.Mutate[TPixel](Image`1 source, Action`1 operation)

This exception is not thrown on Windows in Debug mode, but is thrown on Linux in Release mode. I have not checked Windows/Release and Linux/Debug. See the System Configuration section for details regarding my system information.

Steps to Reproduce

The code which throws this error can be found starting here. Lines 82, 132, 189, 244, and 252 contain a .Resize() call. Please do note that I have not pushed my current working code to github in a long time, so line numbers in the exception may not match the line numbers on github, and neither will the versions installed in the .csproj; but I can assure you the method itself has not changed.

System Configuration

  • ImageSharp version: 1.0.3-alpha.0.35
  • Other ImageSharp packages and versions: ImageSharp.Drawing 1.0.0-beta11.4
  • Environment (Operating system, version and so on): Ubuntu 20.04 x64
  • .NET Framework version: 5.0
  • Additional information: CPU: AMD FX-4350

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions