이미지를 바이트 배열로 변환하려고하면 Null 예외가 발생합니다. 나는 4 등분으로 이미지를 분할하고 각 부분을 Byte Array로 변환 중이다.이미지를 바이트 배열로 변환하면 null 예외가 발생합니다.
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
하지만 난이 된 ImageObject (I1)로 분할 에드 이미지를 가지고 분할 테드 Bitmapimage 객체 (비트)를 할당하고 바이트 배열로 변환 할 때 그것은 나에게 오류를 제공합니다.
과 함께 노력할 것입니다, 그것은 아마 널 (VB.net의 경우 Nothing) – codingbiz
@codingbiz 그렇습니다.하지만 이유는 무엇입니까. 비트 맵 개체를 i1에 할당하고 있습니다. – maddygoround
아마도 대답은'i4 = bit' 줄 앞에있는 코드에 있지만이 코드는 게시물에 보이지 않습니다. – Steve