public void Encode_PreserveRatio <TPixel>(TestImageProvider <TPixel> provider, WebpFileFormatType expectedFormat) where TPixel : unmanaged, IPixel <TPixel> { var options = new WebpEncoder(); using Image <TPixel> input = provider.GetImage(); using var memoryStream = new MemoryStream(); input.Save(memoryStream, options); memoryStream.Position = 0; using var output = Image.Load <Rgba32>(memoryStream); ImageMetadata meta = output.Metadata; WebpMetadata webpMetaData = meta.GetWebpMetadata(); Assert.Equal(expectedFormat, webpMetaData.FileFormat); }
/// <summary> /// Initializes a new instance of the <see cref="WebpMetadata"/> class. /// </summary> /// <param name="other">The metadata to create an instance from.</param> private WebpMetadata(WebpMetadata other) => this.FileFormat = other.FileFormat;