mirror of https://github.com/SixLabors/ImageSharp
3 changed files with 35 additions and 2 deletions
@ -0,0 +1,31 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using System.IO; |
||||
|
using SixLabors.ImageSharp.PixelFormats; |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Image decoder for generating an image out of a jpg stream.
|
||||
|
/// </summary>
|
||||
|
internal sealed class PdfJsJpegDecoder : IImageDecoder, IJpegDecoderOptions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Gets or sets a value indicating whether the metadata should be ignored when the image is being decoded.
|
||||
|
/// </summary>
|
||||
|
public bool IgnoreMetadata { get; set; } |
||||
|
|
||||
|
/// <inheritdoc/>
|
||||
|
public Image<TPixel> Decode<TPixel>(Configuration configuration, Stream stream) |
||||
|
where TPixel : struct, IPixel<TPixel> |
||||
|
{ |
||||
|
Guard.NotNull(stream, nameof(stream)); |
||||
|
|
||||
|
using (var decoder = new PdfJsJpegDecoderCore(configuration, this)) |
||||
|
{ |
||||
|
return decoder.Decode<TPixel>(stream); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue