OK, I've tried the code below, which isn't too different from that above and it works.
One difference is that the two loops that loop through the pixel data should start from 0 and finish from 1 less than the height or width of the image, since co-ordinates start at 0 and not 1.
Another is that Bot Builder's code doesn't close the files after writing or reading. If you've not been doing this then this could be causing the problem, as it thinks the file is still open for writing when it comes to reading it.
However, if you don't want the pixel info in a readable form then I would make use of WriteInt() and ReadInt() instead, as they would produce smaller files.
Graphics 400,300,0,2 old_image=CreateImage(64,64) SetBuffer ImageBuffer(old_image) Color 255,0,0: Rect 0,0,64,64 Color 255,255,255: Text 32,32,"TEST",True,True ; save image file=WriteFile("test.txt") WriteLine file,ImageWidth(old_image) WriteLine file,ImageHeight(old_image) For y=0 To ImageHeight(old_image)-1 For x=0 To ImageWidth(old_image)-1 WriteLine file,ReadPixel(x,y) Next Next CloseFile file ; load new image file=ReadFile("test.txt") w=ReadLine(file) h=ReadLine(file) new_image=CreateImage(w,h) SetBuffer ImageBuffer(new_image) For y=0 To h-1 For x=0 To w-1 WritePixel x,y,ReadLine(file) Next Next CloseFile file ; show image as test SetBuffer FrontBuffer() DrawImage new_image,200-w/2,150-h/2 WaitKey:End
One difference is that the two loops that loop through the pixel data should start from 0 and finish from 1 less than the height or width of the image, since co-ordinates start at 0 and not 1.
Another is that Bot Builder's code doesn't close the files after writing or reading. If you've not been doing this then this could be causing the problem, as it thinks the file is still open for writing when it comes to reading it.
However, if you don't want the pixel info in a readable form then I would make use of WriteInt() and ReadInt() instead, as they would produce smaller files.