public Bitmap DecodeFrame(int frameIndex, out ImageInfo imageInfo)
{
// check requested frame index
if (frameIndex != 0)
{
throw new ArgumentOutOfRangeException("Currently opened stream does not contain frame with specified index.");
}
// seek to the required frame
stream.Seek(dataPosition, SeekOrigin.Begin);
// read required frame
Bitmap image = ReadImageFrame(stream, this.imageInfo);
// provide also frame information
imageInfo = (PNMImageInfo)this.imageInfo.Clone();
return image;
}