예제 #1
0
        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);
        }