|
|
|
@ -198,6 +198,20 @@ namespace SixLabors.ImageSharp.Formats.Jpeg |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
=> this.Decode<TPixel>(stream, targetSize: null, cancellationToken); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public IImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
this.ParseStream(stream, spectralConverter: null, cancellationToken); |
|
|
|
this.InitExifProfile(); |
|
|
|
this.InitIccProfile(); |
|
|
|
this.InitIptcProfile(); |
|
|
|
this.InitXmpProfile(); |
|
|
|
this.InitDerivedMetadataProperties(); |
|
|
|
|
|
|
|
Size pixelSize = this.Frame.PixelSize; |
|
|
|
return new ImageInfo(new PixelTypeInfo(this.Frame.BitsPerPixel), pixelSize.Width, pixelSize.Height, this.Metadata); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Decodes and downscales the image from the specified stream if possible.
|
|
|
|
/// </summary>
|
|
|
|
@ -205,10 +219,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg |
|
|
|
/// <param name="stream">Stream.</param>
|
|
|
|
/// <param name="targetSize">Target size.</param>
|
|
|
|
/// <param name="cancellationToken">Cancellation token.</param>
|
|
|
|
public Image<TPixel> DecodeInto<TPixel>(BufferedReadStream stream, Size targetSize, CancellationToken cancellationToken) |
|
|
|
internal Image<TPixel> DecodeInto<TPixel>(BufferedReadStream stream, Size targetSize, CancellationToken cancellationToken) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
=> this.Decode<TPixel>(stream, targetSize, cancellationToken); |
|
|
|
|
|
|
|
private Image<TPixel> Decode<TPixel>(BufferedReadStream stream, Size? targetSize, CancellationToken cancellationToken) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
using var spectralConverter = new SpectralConverter<TPixel>(this.Configuration, targetSize); |
|
|
|
this.ParseStream(stream, spectralConverter, cancellationToken); |
|
|
|
this.InitExifProfile(); |
|
|
|
this.InitIccProfile(); |
|
|
|
@ -222,20 +240,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg |
|
|
|
this.Metadata); |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public IImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
this.ParseStream(stream, spectralConverter: null, cancellationToken); |
|
|
|
this.InitExifProfile(); |
|
|
|
this.InitIccProfile(); |
|
|
|
this.InitIptcProfile(); |
|
|
|
this.InitXmpProfile(); |
|
|
|
this.InitDerivedMetadataProperties(); |
|
|
|
|
|
|
|
Size pixelSize = this.Frame.PixelSize; |
|
|
|
return new ImageInfo(new PixelTypeInfo(this.Frame.BitsPerPixel), pixelSize.Width, pixelSize.Height, this.Metadata); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Load quantization and/or Huffman tables for subsequent use for jpeg's embedded in tiff's,
|
|
|
|
/// so those tables do not need to be duplicated with segmented tiff's (tiff's with multiple strips).
|
|
|
|
@ -1263,6 +1267,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg |
|
|
|
if (!metadataOnly) |
|
|
|
{ |
|
|
|
this.Frame.Init(maxH, maxV); |
|
|
|
this.scanDecoder.InjectFrameData(this.Frame, this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|