图像处理模块(待补完)
来源:互联网 发布:caxa编程助手2.3下载 编辑:程序博客网 时间:2024/06/06 02:04
Imports System.DrawingImports System.Drawing.ImagingImports System.Runtime.CompilerServicesPublic Module ImageHelper ''' <summary> ''' 按指定大小切割图像 ''' </summary> ''' <param name="Image">要切割的Bitmap</param> ''' <param name="width">每个图像的宽度</param> ''' <param name="height">每个图像的高度</param> ''' <returns>返回切割后的图像枚举器</returns> <Extension()> Public Function Splite(ByVal Image As Bitmap, ByVal width As Integer, ByVal height As Integer) As IEnumerable(Of Bitmap) Dim list As New List(Of Bitmap) Dim c As Integer = Image.Width \ width Dim r As Integer = Image.Height \ height For i = 0 To r - 1 For j = 0 To c - 1 Dim rtg As New Rectangle(j * width, i * height, width, height) Dim b As Bitmap = Image.Clone(rtg, PixelFormat.Format24bppRgb) list.Add(b) Next Next Return list End FunctionEnd Module