当我尝试将图像转换为字节数组时,它给了我空异常。我将图像分成 4 个相等的部分,然后将每个部分转换为字节数组。
OpenFileDialog1.ShowDialog()
i = Image.FromFile(OpenFileDialog1.FileName)
Dim g As Graphics
Dim OriginalBit As New Bitmap(i)
Dim x1 = 0, y1 = 0, x, y, k As Integer
x = i.Width / 2
y = i.Height / 2
Dim i1, i2, i3, i4 As Image
Dim bit As Bitmap = OriginalBit.Clone(New RectangleF(0, 0, x, y), Imaging.PixelFormat.DontCare)
PictureBox2.Width = bit.Width
PictureBox2.Height = bit.Height
i1 = bit
但是,当我将拆分后的 Bitmapimage 对象(位)分配给 Imageobject(i1)并尝试将其转换为字节数组时,它给了我错误。