mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
// <copyright file="PngTests.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageProcessorCore.Tests
|
|
{
|
|
using System.IO;
|
|
|
|
using Formats;
|
|
|
|
using Xunit;
|
|
|
|
public class PngTests : FileTestBase
|
|
{
|
|
[Fact]
|
|
public void ImageCanSaveIndexedPng()
|
|
{
|
|
if (!Directory.Exists("TestOutput/Encode/Png"))
|
|
{
|
|
Directory.CreateDirectory("TestOutput/Encode/Png");
|
|
}
|
|
|
|
foreach (string file in Files)
|
|
{
|
|
using (FileStream stream = File.OpenRead(file))
|
|
{
|
|
Image image = new Image(stream);
|
|
|
|
using (FileStream output = File.OpenWrite($"TestOutput/Encode/Png/{Path.GetFileNameWithoutExtension(file)}.png"))
|
|
{
|
|
image.Quality = 256;
|
|
image.Save(output, new PngFormat());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|