Hi.
I have a single sprite sheet (bitmap file) with a number of frames for an animation on it. I want to split the sheet so that each frame goes into a seperate bitmap file.
Does anyone know how I can do that in PSP or even MS Paint? Or is there some tool out there to do it?
Cheers,
Codefire
Paint Shop Pro 7 - splitting sprite sheet
-
- Enthusiast
- Posts: 289
- Joined: Mon Apr 02, 2007 7:22 am
- Location: Finland
Re: Paint Shop Pro 7 - splitting sprite sheet
I don't know about PSP but why don't you write a simple program in PB to
accomplish this task?
Something like this (not much more than pseudo-code):
accomplish this task?
Something like this (not much more than pseudo-code):
Code: Select all
For y=0 To #imageWidth-1 Step #sliceWidth
For x=0 To #imageHeight-1 Step #sliceHeight
GrabImage(#originalImage, #sliceImage, x, y, #sliceWidth, #sliceHeight)
SaveImage(#sliceImage, "slice" + Str(i) + ".bmp")
Next
Next
Good programmers don't comment their code. It was hard to write, should be hard to read.
Re: Paint Shop Pro 7 - splitting sprite sheet
Yes, I think that might actually be the easiest way for me!traumatic wrote:I don't know about PSP but why don't you write a simple program in PB to
accomplish this task?
Something like this (not much more than pseudo-code):Code: Select all
For y=0 To #imageWidth-1 Step #sliceWidth For x=0 To #imageHeight-1 Step #sliceHeight GrabImage(#originalImage, #sliceImage, x, y, #sliceWidth, #sliceHeight) SaveImage(#sliceImage, "slice" + Str(i) + ".bmp") Next Next

Cheers!
..and here for posterity is the actual code I used. It seems PureBasic makes things very easy
Thanks Traumatic.
Codefire.

Codefire.
Code: Select all
#IMAGE_WIDTH = 480
#IMAGE_HEIGHT = 360
#CHUNK_WIDTH = 80
#CHUNK_HEIGHT = 60
Enumeration
#original_image
#new_image
EndEnumeration
filename.s = "ship05.bmp"
result.l
result = LoadImage(#original_image, filename)
If result
For y=0 To #IMAGE_HEIGHT-1 Step #CHUNK_HEIGHT
For x=0 To #IMAGE_WIDTH-1 Step #CHUNK_WIDTH
GrabImage(#original_image, #new_image, x, y, #CHUNK_WIDTH, #CHUNK_HEIGHT)
SaveImage(#new_image, "BlueShip_" + Str(i) + ".bmp")
i+1
Next
Next
EndIf