获得图片的宽度和高度

2017-02-14 12:28:45  访问(1519) 赞(0) 踩(0)


    protected int GetImageW(string imageFileName)
    {
        try
        {
            System.Drawing.Image img
            =
            System.Drawing.Image.FromFile(imageFileName);

            int theResult = img.Width;

            img.Dispose();

            return theResult;
        }
        catch
        {
            return 0;
        }
    }

    protected int GetImageH(string imageFileName)
    {
        try
        {
            System.Drawing.Image img
            =
            System.Drawing.Image.FromFile(imageFileName);

            int theResult = img.Height;

            img.Dispose();

            return theResult;
        }
        catch
        {
            return 0;
        }
    }
     


标签:获得图片的宽度和高度 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)