vb.net - 使用VB.Net获取图像宽度和高度

标签 vb.net

在 VB.net 中,我需要读取一个充满图像的文件夹并获取它们:文件名、以像素为单位的高度和以像素为单位的宽度,并将它们的值分配给各个变量。

谢谢。

迈克。

最佳答案

试试这个:

Imports System.IO
Imports System.Drawing
Module Module1

    Sub Main()
        Dim s As New DirectoryInfo("C:/Files")
        Dim files As FileInfo() = s.GetFiles("*.jpg")
        For Each f As FileInfo In files
            Dim bmp As New Bitmap(f.FullName)
            Console.WriteLine("Width: " & bmp.Width.ToString() + " > Height: " & bmp.Height.ToString())
        Next
        Console.Read()
    End Sub

End Module

关于vb.net - 使用VB.Net获取图像宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14991802/

相关文章:

vb.net - 由于继承抽象类而禁用设计器?

mysql - vb.net 插入查询

vb.net - 如何将字符串转换为 UTF-16LE,然后转换为 Base64?

vb.net - 使用 DataContext 类和 SqlConnection 之间有什么区别?

c# - C# 和 VB 之间的 Linq Select 编译方式不同

vb.net - 有条件地控制 .NET 报告 (rdlc) 中背景图像的可见性

asp.net - SignalR StockTicker 示例不起作用

vb.net - GetVSTOObject 不返回任何内容

vb.net - 在 VB.NET 表单中打开 Lotus Notes

asp.net - 请求在此上下文中不可用