saucecontrol / PhotoSauce

MagicScaler high-performance, high-quality image processing pipeline for .NET
http://photosauce.net/
MIT License
589 stars 49 forks source link

Method not found when converting WebP -> PNG in 0.14.2 #158

Closed nox7 closed 5 months ago

nox7 commented 5 months ago

Edit: This seems to happen with just any image, including just a processing a PNG. I assume I have a mistmatch version of something but everything is up-to-date and I can't identify the issue.

I am trying to set a pipeline where the source stream is a WebP file stream, the encoder is set to PNG, and then I call WriteOutput on the pipeline. I am using all native codecs and they are up-to-date.

Exception thrown

System.MissingMethodException: Method not found: 'System.Drawing.Rectangle PhotoSauce.MagicScaler.PixelArea.op_Implicit(PhotoSauce.MagicScaler.PixelArea ByRef)'.
         at PhotoSauce.NativeCodecs.Libpng.PngEncoder.writePixels(IPixelSource src, PixelArea area)
         at PhotoSauce.NativeCodecs.Libpng.PngEncoder.WriteFrame(IPixelSource source, IMetadataSource metadata, Rectangle sourceArea)
         at PhotoSauce.MagicScaler.MagicImageProcessor.WriteOutput(PipelineContext ctx, Stream ostm)
         at PhotoSauce.MagicScaler.ProcessingPipeline.WriteOutput(Stream outStream)

Reproduction code (it looks a little weird as I took it all out of some other logic, but it reproduces the error either way)

// Use PS codecs
CodecManager.Configure(codecs =>
{
  codecs.UseLibwebp();
  codecs.UseLibpng();
  codecs.UseLibjpeg();
  codecs.UseGiflib();
  codecs.UseLibheif();
  codecs.UseLibjxl();
});

Stream imageFileStream = ?; // File stream to WebP
ProcessImageSettings imageProcessorSettings = new();
imageProcessorSettings.TrySetEncoderFormat(ImageMimeTypes.Png);
imageFileStream.Seek(0, SeekOrigin.Begin);
var pipeline = MagicImageProcessor.BuildPipeline(
  imageFileStream,
  imageProcessorSettings
);
using MemoryStream fileOutputStream = new();
pipeline.WriteOutput(fileOutputStream);

NuGet codecs versions image

Source image: https://www.footbridgemedia.com/uplift-data/images/horizontal-logo-dark-tagline.webp

Am I going about this incorrectly?

nox7 commented 5 months ago

NuGet Package Manager UI doesn't show the latest previews. It'll say it's up-to-date, but there were months of previews I was missing.

Checked another issue where the code owner responded to a similar issue and wrote the packages were outdated.