diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs index 948f4dc8cc..391dac784f 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs @@ -11,11 +11,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder /// internal interface IRawJpegData : IDisposable { - /// - /// Gets the image size in pixels. - /// - Size ImageSizeInPixels { get; } - /// /// Gets the color space /// diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs index a1242a43a3..4baaab3868 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs @@ -43,6 +43,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder /// public int PixelWidth { get; set; } + /// + /// Gets the pixel size of the image. + /// + public Size PixelSize => new Size(this.PixelWidth, this.PixelHeight); + /// /// Gets or sets the number of components within a frame. In progressive frames this value can range from only 1 to 4. /// diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs index 0fd4b2f0f5..04495f1721 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs @@ -110,23 +110,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg public Size ImageSizeInPixels { get; private set; } /// - Size IImageDecoderInternals.Dimensions => this.ImageSizeInPixels; + Size IImageDecoderInternals.Dimensions => this.Frame.PixelSize; /// /// Gets the number of MCU blocks in the image as . /// public Size ImageSizeInMCU { get; private set; } - /// - /// Gets the image width - /// - public int ImageWidth => this.ImageSizeInPixels.Width; - - /// - /// Gets the image height - /// - public int ImageHeight => this.ImageSizeInPixels.Height; - /// /// Gets a value indicating whether the metadata should be ignored when the image is being decoded. /// @@ -214,7 +204,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg this.InitIptcProfile(); this.InitDerivedMetadataProperties(); - return new ImageInfo(new PixelTypeInfo(this.Frame.BitsPerPixel), this.ImageWidth, this.ImageHeight, this.Metadata); + Size pixelSize = this.Frame.PixelSize; + return new ImageInfo(new PixelTypeInfo(this.Frame.BitsPerPixel), pixelSize.Width, pixelSize.Height, this.Metadata); } /// @@ -853,8 +844,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg ComponentCount = componentCount }; - this.ImageSizeInPixels = new Size(this.Frame.PixelWidth, this.Frame.PixelHeight); - this.Metadata.GetJpegMetadata().ColorType = this.ColorSpace == JpegColorSpace.Grayscale ? JpegColorType.Luminance : JpegColorType.YCbCr; if (!metadataOnly)