diff --git a/src/ImageSharp/Formats/Tiff/ImageExtensions.cs b/src/ImageSharp/Formats/Tiff/ImageExtensions.cs new file mode 100644 index 0000000000..01384b8271 --- /dev/null +++ b/src/ImageSharp/Formats/Tiff/ImageExtensions.cs @@ -0,0 +1,53 @@ +// +// 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 tiff format. + /// + /// The pixel format. + /// The image this method extends. + /// The stream to save the image to. + /// Thrown if the stream is null. + /// + /// The . + /// + public static Image SaveAsTiff(this Image source, Stream stream) + where TColor : struct, IPixel + { + return SaveAsTiff(source, stream, null); + } + + /// + /// Saves the image to the given stream with the tiff 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 SaveAsTiff(this Image source, Stream stream, ITiffEncoderOptions options) + where TColor : struct, IPixel + { + TiffEncoder encoder = new TiffEncoder(); + encoder.Encode(source, stream, options); + + return source; + } + } +}