loading in an image from a bank
BlitzMax Forums/BlitzMax Programming/loading in an image from a bank| 
 | ||
| Hi I'm try to read an JPEG image from a bank. This image can be anywhere in the bank, but i will know it start location and filesize. an example that works.. 
b:TBank = LoadBank("input.jpg")
p = LoadPixmap(b)
SavePixmapJPeg p,"output.jpg"
but what if there was a lot of other data around that image file. I want to do something like this.. but I know this doesn't work. 
b:TBank = LoadBank("input.jpg")
bp = bankbuf(b)
p = LoadPixmap(bp[0]..bp[banksize(b)-1])
SavePixmapJPeg p,"output.jpg"
Any ideas anyone? | 
| 
 | ||
| I've noe sorted it with a BankSegment function 
b:TBank = LoadBank("input.jpg")
p = LoadPixmap(banksegment(b,0,BankSize(b)-1))
SavePixmapJPeg p,"output.jpg"
Function BankSegment:TBank(bank:TBank,position:Int,length:Int)
	Local des_bank:TBank = CreateBank(length)
	CopyBank(bank,position,des_bank,0,length)
	Return des_bank
End Function
unless there is another way? | 
| 
 | ||
| pixmap:TPixmap = LoadPixmap(CreateStaticBank(bankbuf(b) + imageOffset, imageSize)) | 
| 
 | ||
| cheers (i even saw that command and dismissed it lol) |