Hi all, I have thought about doing a program for this since trying the image joiner and finding it pretty horrible. After seeing this post last night I thought I'd finally get round to doing one. Its basic but should work ok as far as I've tested it.
Rem Project: Sprite Maker
Rem Created: Tuesday, October 18, 2011
Rem ***** Main Source File *****
` search directory and make a copy of all listings
find first
repeat
dircheck$=dircheck$+GET FILE NAME$()
find next
until get file type()=-1
` get number of images
for n= 1 to len(dircheck$)
lettercheck$=mid$(dircheck$,n)
wordcheck$=worcheck$+lettercheck$
if wordcheck$="."
if mid$(dircheck$,n+1)="p"
if mid$(dircheck$,n+2)="n"
if mid$(dircheck$,n+3)="g"
inc wordcount
wordcheck$=""
endif
endif
endif
endif
next n
text 0,0,dircheck$
text 0,40,"Images found "+str$(wordcount)
set cursor 310,40
center text 320,20,"Enter image name."
input image$
cls
set cursor 310,40
center text 320,20,"Enter file type eg .png"
input file$
cls
imagenumber$=str$(wordcount)
for n=1 to val(imagenumber$)
load image image$+str$(n)+file$,n,1
width=image width(n)
height=image height(n)
next n
bitmapy=ceil(sqrt(val(imagenumber$)))
bitmapx=ceil(sqrt(val(imagenumber$)))
create bitmap 1,bitmapx*width,bitmapy*height
set current bitmap 1
for y=1 to bitmapy
for x=1 to bitmapx
tile=tile+1
if image exist(tile)
paste image tile,(x-1)*image width(tile),(y-1)*image height(tile)
endif
next x
next y
get image 1,0,0,bitmapx*width,bitmapy*height,1
set current bitmap 0
cls rgb(0,255,255)
copy bitmap 1,0
if file exist("sprite_sheets")=0
make directory "Sprite_sheets"
endif
save image "Sprite_sheets/"+image$+"_sheet"+file$,1
do
text 0,400,"Total image width "+str$(bitmapx*width)
text 0,420,"Total image height "+str$(bitmapy*height)
text 0,440,"image number "+imagenumber$
sync
loop
It won't auto crop images it just scans its root directory for .png files. Then asks you to type the name. Just use the name and not the image number or file extension. So for "man1.png" use "man", then type in the extension next, so ".png". I was going to support multiple file types but couldn't be bothered in the end, so that could be altered. Once you have entered that, it should tile your images and save to the sprite_sheet directory.
If anyone wants to improve on it they are welcome.
@Bjadams, for auto cropping images to the smallest possible size, try jasc animation studio, which comes with psp 7. It is an old but fairly useful tool. The only problem you may have is it doesn't seem to work with transparencies too well, and you may end up with black backdrops rather than clear ones.
You should find it here as it is now free to use. I paid about £70 for it when it was new and spangly lol.
http://download.cnet.com/windows/