/// <summary> /// Initializes a new instance that implements <see cref="IMagickImageCollection{TQuantumType}"/>. /// </summary> /// <param name="stream">The stream to read the image data from.</param> /// <param name="readSettings">The settings to use when reading the image.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A new <see cref="IMagickImageCollection{TQuantumType}"/> instance.</returns> /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception> public async Task <IMagickImageCollection <QuantumType> > CreateAsync(Stream stream, IMagickReadSettings <QuantumType> readSettings, CancellationToken cancellationToken) { var images = new MagickImageCollection(); await images.ReadAsync(stream, readSettings, cancellationToken).ConfigureAwait(false); return(images); }
/// <summary> /// Initializes a new instance that implements <see cref="IMagickImageCollection{TQuantumType}"/>. /// </summary> /// <param name="file">The file to read the image from.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A new <see cref="IMagickImageCollection{TQuantumType}"/> instance.</returns> /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception> public async Task <IMagickImageCollection <QuantumType> > CreateAsync(FileInfo file, CancellationToken cancellationToken) { var images = new MagickImageCollection(); await images.ReadAsync(file, cancellationToken).ConfigureAwait(false); return(images); }