就是读取一个文件, 写一个图片, 第一个像素为文件大小, 其他像素为文件内容RGB分别是一个字节。经测试, 貌似生成的图片比源文件小。
Function ToPic(ByVal file As String) As Bitmap
Using fs As New FileStream(file, FileMode.Open, FileAccess.Read)
Dim xx As Integer = Math.Sqrt(fs.Length / 3)
Dim h As Integer = fs.Length / (3 * xx) + 1
'If fs.Length Mod (3 * xx) > 0 Then
' h += 1
'End If
Dim pic As New Bitmap(xx, h)
Dim x = 1, y = 0
Dim r, g, b As Byte
r = fs.Length / 256 / 256
g = fs.Length / 256 Mod 256
b = fs.Length Mod 256
pic.SetPixel(0, y, Color.FromArgb(255, r, g, b))
Do While fs.Position < fs.Length
If x >= xx Then
y += 1
x = 0
End If
If fs.Position < fs.Length Then
r = fs.ReadByte
End If
If fs.Position < fs.Length Then
g = fs.ReadByte
End If
If fs.Position < fs.Length Then
b = fs.ReadByte
End If
pic.SetPixel(x, y, Color.FromArgb(255, r, g, b))
x += 1
Loop
Return pic
End Using
End Function

图片还有文件头呢,为啥会小呢?
不知道