/// <summary> /// Writes the image to the specified stream. /// </summary> /// <param name="stream">The stream to write the image data to.</param> /// <param name="format">The format to use.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception> public async Task WriteAsync(Stream stream, MagickFormat format, CancellationToken cancellationToken) { using (_ = new TemporaryMagickFormat(this, format)) { await WriteAsync(stream, cancellationToken).ConfigureAwait(false); } }
/// <summary> /// Writes the images to the specified buffer writter. If the output image's file format does not /// allow multi-image files multiple files will be written. /// </summary> /// <param name="bufferWriter">The buffer writer to write the images to.</param> /// <param name="format">The format to use.</param> /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception> public void Write(IBufferWriter <byte> bufferWriter, MagickFormat format) { using (_ = new TemporaryMagickFormat(this, format)) { Write(bufferWriter); } }