我正在尝试检查一组图像(通常超过 50 个,每个大约 3 Mb)的方向。当我已经处理了一堆时,我得到“内存不足”错误。
所以我的问题是如何分别检查每个图像以使用最少的内存?
我对 vb.net 和编程真的很陌生,所以这是我弄清楚如何完成任务的唯一方法:
Dim MyFiles As New ArrayList()
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
TextBox2.Clear()
If CheckBox2.Checked = True Then
TextBox2.Text = "Checking the orientation of the images ..." & vbNewLine & vbNewLine
For i As Integer = 0 To MyFiles.Count - 1
TextBox2.AppendText("Checking " & MyFiles(i) & vbNewLine)
If Image.FromFile(MyFiles(i)).Width < Image.FromFile(MyFiles(i)).Height Then
TextBox2.AppendText(vbNewLine & "There are images with portrait orientation. Splitting aborted!" & vbNewLine)
Return
End If
Next
TextBox2.AppendText(vbNewLine & "All images are with landscape orientation." & vbNewLine)
End If
'ConvertBMP("C:\test.bmp", ImageFormat.Jpeg)
End Sub