/// <summary> /// Encodes the image to the specified stream from the <see cref="Image{TColor}"/>. /// </summary> /// <typeparam name="TColor">The pixel format.</typeparam> /// <param name="image">The <see cref="Image{TColor}"/> to encode from.</param> /// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param> /// <param name="options">The options for the encoder.</param> public void Encode <TColor>(Image <TColor> image, Stream stream, IPngEncoderOptions options) where TColor : struct, IPixel <TColor> { PngEncoderCore encode = new PngEncoderCore(options); encode.Encode(image, stream); }
/// <summary> /// Encodes the image to the specified stream from the <see cref="Image{TPixel}"/>. /// </summary> /// <typeparam name="TPixel">The pixel format.</typeparam> /// <param name="image">The <see cref="Image{TPixel}"/> to encode from.</param> /// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param> public void Encode <TPixel>(Image <TPixel> image, Stream stream) where TPixel : struct, IPixel <TPixel> { using (var encoder = new PngEncoderCore(this)) { encoder.Encode(image, stream); } }
/// <summary> /// Encodes the image to the specified stream from the <see cref="Image{TPixel}"/>. /// </summary> /// <typeparam name="TPixel">The pixel format.</typeparam> /// <param name="image">The <see cref="Image{TPixel}"/> to encode from.</param> /// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param> /// <param name="options">The options for the encoder.</param> public void Encode <TPixel>(Image <TPixel> image, Stream stream, IPngEncoderOptions options) where TPixel : struct, IPixel <TPixel> { using (var encode = new PngEncoderCore(options)) { encode.Encode(image, stream); } }
/// <inheritdoc/> public void Encode <TColor>(Image <TColor> image, Stream stream) where TColor : struct, IPackedPixel, IEquatable <TColor> { PngEncoderCore encoder = new PngEncoderCore { CompressionLevel = this.CompressionLevel, Gamma = this.Gamma, Quality = this.Quality, PngColorType = this.PngColorType, Quantizer = this.Quantizer, WriteGamma = this.WriteGamma, Threshold = this.Threshold }; encoder.Encode(image, stream); }