diff --git a/src/ImageSharp/Formats/Icon/IconDecoderCore.cs b/src/ImageSharp/Formats/Icon/IconDecoderCore.cs
index 0feed7f693..ce72f15612 100644
--- a/src/ImageSharp/Formats/Icon/IconDecoderCore.cs
+++ b/src/ImageSharp/Formats/Icon/IconDecoderCore.cs
@@ -170,7 +170,7 @@ internal abstract class IconDecoderCore : IImageDecoderInternals
bool isPng = flag.SequenceEqual(PngConstants.HeaderBytes);
// Decode the frame into a temp image buffer. This is disposed after the frame is copied to the result.
- ImageInfo temp = this.GetDecoder(isPng).Identify(stream, cancellationToken);
+ ImageInfo frameInfo = this.GetDecoder(isPng).Identify(stream, cancellationToken);
ImageFrameMetadata frameMetadata = new();
@@ -178,14 +178,14 @@ internal abstract class IconDecoderCore : IImageDecoderInternals
{
if (i == 0)
{
- pngMetadata = temp.Metadata.GetPngMetadata();
+ pngMetadata = frameInfo.Metadata.GetPngMetadata();
}
- frameMetadata.SetFormatMetadata(PngFormat.Instance, temp.FrameMetadataCollection[0].GetPngMetadata());
+ frameMetadata.SetFormatMetadata(PngFormat.Instance, frameInfo.FrameMetadataCollection[0].GetPngMetadata());
}
else
{
- BmpMetadata meta = temp.Metadata.GetBmpMetadata();
+ BmpMetadata meta = frameInfo.Metadata.GetBmpMetadata();
bitsPerPixel = meta.BitsPerPixel;
colorTable = meta.ColorTable;
@@ -210,7 +210,7 @@ internal abstract class IconDecoderCore : IImageDecoderInternals
// Since Windows Vista, the size of an image is determined from the BITMAPINFOHEADER structure or PNG image data
// which technically allows storing icons with larger than 256 pixels, but such larger sizes are not recommended by Microsoft.
- this.Dimensions = new(Math.Max(this.Dimensions.Width, temp.Size.Width), Math.Max(this.Dimensions.Height, temp.Size.Height));
+ this.Dimensions = new(Math.Max(this.Dimensions.Width, frameInfo.Size.Width), Math.Max(this.Dimensions.Height, frameInfo.Size.Height));
}
// Copy the format specific metadata to the image.
diff --git a/src/ImageSharp/ImageInfo.cs b/src/ImageSharp/ImageInfo.cs
index 3a2e870176..0bbd73b63a 100644
--- a/src/ImageSharp/ImageInfo.cs
+++ b/src/ImageSharp/ImageInfo.cs
@@ -62,6 +62,11 @@ public class ImageInfo
///
public int Height => this.Size.Height;
+ ///
+ /// Gets the number of frames in the image.
+ ///
+ public int FrameCount => this.FrameMetadataCollection.Count;
+
///
/// Gets any metadata associated with the image.
///
@@ -75,10 +80,10 @@ public class ImageInfo
///
/// Gets the size of the image in px units.
///
- public Size Size { get; internal set; }
+ public Size Size { get; }
///
/// Gets the bounds of the image.
///
- public Rectangle Bounds => new(0, 0, this.Width, this.Height);
+ public Rectangle Bounds => new(Point.Empty, this.Size);
}