FRBDK/FlatRedBall.AnimationEditorForms/IO/ImageHeader.cs
/// <summary>        
/// Gets the dimensions of an image.        
/// </summary>        
/// <param name="path">The path of the image to get the dimensions of.</param>        
/// <returns>The dimensions of the specified image.</returns>        
/// <exception cref="ArgumentException">The image was of an unrecognised format.</exception>        
Gets the dimensions of an image.
Gets the dimensions of an image .
public static Size GetDimensions(string path)
        {
            if (File.Exists(path))
            {
                try
                {
                    using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(path)))
                    {
                        try
                        {
                            return GetDimensions(binaryReader);
                        }
                        catch (ArgumentException e)
                        {
                            string newMessage = string.Format("{0} file: '{1}' ", errorMessage, path);
                            throw new ArgumentException(newMessage, "path", e);
                        }
                    }
                }
                catch (ArgumentException)
                {
                    using (Bitmap b = new Bitmap(path))
                    {
                        return b.Size;
                    }
                }
            }
            else
            {
                return new Size();
            }
        }
public static Size GetDimensions ( string path ) { if ( File . Exists ( path ) ) { try { using ( BinaryReader binaryReader = new BinaryReader ( File . OpenRead ( path ) ) ) { try { return GetDimensions ( binaryReader ) ; } catch ( ArgumentException e ) { string newMessage = string . Format ( " " , errorMessage , path ) ; throw new ArgumentException ( newMessage , " " , e ) ; } } } catch ( ArgumentException ) { using ( Bitmap b = new Bitmap ( path ) ) { return b . Size ; } } } else { return new Size ( ) ; } }
Gets the dimensions of an image.
Gets the dimensions of an image .
//do it the old fashioned way
The dimensions of the specified image.
The dimensions of the specified image .
The image was of an unrecognised format.
The image was of an unrecognised format .
path
string
The path of the image to get the dimensions of.
The path of the image to get the dimensions of .