jason2li
Member
I have a large image (PNG: 22,550 x 16,7000) that I need to somehow split into several 256x256 JPG tiles.
But when I try to load it into a Bitmap (or Image) object, I keep getting an "Out of Memory Exception" error.
So, I was wondering if there is a better way to split an image up? Or is there a way to increase the allowed memory for my application.
I tried 2 different versions:
And:
But either way I do it, it throws an "Out of Memory" exception.
Thanks in advance!
But when I try to load it into a Bitmap (or Image) object, I keep getting an "Out of Memory Exception" error.
So, I was wondering if there is a better way to split an image up? Or is there a way to increase the allowed memory for my application.
I tried 2 different versions:
VB.NET:
[COLOR="Red"]Dim bmp As Bitmap = Bitmap.FromFile(path)[/COLOR]
And:
VB.NET:
Dim f As New FileStream(path, FileMode.Open)
Dim fi As New FileInfo(path)
Dim b(fi.Length) As Byte
f.Read(b, 0, b.Length)
f.Close()
Dim stream As New MemoryStream(b)
[COLOR="Red"]Dim bmp As New Bitmap(stream)[/COLOR]
But either way I do it, it throws an "Out of Memory" exception.
Thanks in advance!