save image to a txt file?

Blitz3D Forums/Blitz3D Programming/save image to a txt file?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

erm 0_0

Untested
fil=WriteFile("image.txt")

WriteLine fil,ImageWidth(img)
WriteLine fil,ImageHeight(img)
SetBuffer ImageBuffer(img)
For x=1 to ImageWidth(img)
 For y=1 to ImageHeight(img)
  WriteLine fil,ReadPixel(x,y)
 Next
Next

fil=ReadFile("image.txt")

w=ReadLine$(fil)
h=ReadLine$(fil)
img=CreateImage(w,h)
For x=1 to w
 For y=1 to h
  WritePixel x,y,Readline$(fil)
 Next
Next


Not sure why you would want to do this though. its more inefficient thatn a bmp :D