// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp { using System.IO; using Formats; /// /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Saves the image to the given stream with the png format. /// /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// The options for the encoder. /// Thrown if the stream is null. /// /// The . /// public static Image SaveAsPng(this Image source, Stream stream, IPngEncoderOptions options = null) where TColor : struct, IPixel { PngEncoder encoder = new PngEncoder(); encoder.Encode(source, stream, options); return source; } } }