Need program for combining animation frames!

Miscellaneous Forums/General Discussion/Need program for combining animation frames!

I need a program which takes animation frames in 24bit PNG format, with alpha, and spits out a roughly square image with all the frames side by side as needed when loading an animimage.

Does anyone have something like this? Or know if there's a way to do it in a batch job with Photoshop? Or Debabelizer?

It's called a contact sheet I think?

Don;t know of a specific program but I acheive this with GraphicsGale. All I do is make my tiles/images on seperate frames then export the animation as asingle sheet ready for LoadAnimImage.

Didn't Gabriel make a program that does what you mentioned?
(including a lot more)

I tried a bunch of different options but GraphicsGale doesn't seem to be able to import or export PNG with alpha. It imports the images fine, but they don't have appear to alpha after import, and they definitely don't have alpha after export, and the alpha options in the preferences don't seem to have any effect on this.

GlueIt

??

do you have 3dsMAX? I have a script I use in Max that does this for me.

What about GlueIt?

That requires .NET and I refuse to install that on my system. I installed it on my dad's system and it screwed it up so bad I had to reinstall everything.

Why would someone write an app that requires the C equivalent to the Visual Basic runtime anyway? In order to run the app you have to install .NET. But to install .NET you have to install Service Pack 2 or the Windows 3.0 Installer. And to install THAT you have to innstall the windows Geninune Advantage verification tool! It's like 3x WORSE than the Visual Basic runtime!

How long would it take you to code up a little app to do this yourself? ;)

[edit] Can IrfanView do this? I'm not sure, TBH. :)

I actually found a great program that does all of this. I have the link bookmarked at another house though, so I'll give you the link when I get to it later tonight.

"How long would it take you to code up a little app to do this yourself? ;)"


Does max save PNG's with transparency? I doubt it, so quite a while probably.

Also it's not for me it's for an artist I've hired, so it needs to have a nice user interface. I told him to check out that other program though maybe he won't mind installing .NET. :-)

Did you look at IrfanView?

As I stated above, I have a 3dsMax script that does this, so if your artist uses max I can send it to you. It has a gui and is dead simple to use.

Before this script, I used to split out the alpha and color into individual files, sequence them with a small blitz program I wrote, and then take the 2 outputs back into Photoshop where I would combine the alpha with the color again. Don't know if that is any help, but it worked great for me until the (3ds)max script.

Big10:
Yes. IfranView doen't retain the alpha info.

Pongo:
I don't know. But send me the script and I'll pass it along to him if he does.

U can try my little Program i called AlphaStripper. It takes png images (with alpha) and put it into one big image with the ability to adjust or/and center the images.

It is only in german language (sorry for that) but should be intuitiv.

To bad, just in this second my server is down but maybe tomorrow it should work. go on my site: http://www.east-power-soft.de and under SOFTWARE / PROGRAMME u will find ALPHASTRIPPER.

If the server dosn't work, tell it and i can send it per mail directly.

EDIT: Now, the server works again...here the direct link to the site: http://eps.designdevil.de/index.php?show=software/progs/alpha


Does max save PNG's with transparency? I doubt it, so quite a while probably.



SavePixmapPNG(). its in the docs. wrote an app for the task you requested in bPlus but no transparency. writing it in bMax shouldn't be difficult.

it would all be nice and simple if bmax could save bmp/png.

Erm, BlitzMax saves PNG with alpha channel, and you can save as JPG as well (obviously no alpha channel there).

[edit]Yes, tonyg I have seen Alex O's post, but apparently smilertoo hadn't...

SavePixmapPNG(). its in the docs.


There's also the freeimagelib dll that can be used with Blitz3D, i think it's in the code archives, or on blitzcoder. Th Lib can save PNG, although not sure if it can handle alpha.
You could save it as TGA (archives).

Hey guys...

GlueIt doesn't work.

The artist tried it, and when it combines the frames it introduces shaking to the sprite because it seems to offset some frames incorrectly in the final image.


Also, Pongo, the 3DS Max script you sent me won't load in Max 8.

I know it loads in max 8,... tested it before sending it to you and all was fine here. Does the guy know how to use maxscript?

If you have some images, send them my way and I'll make you a sheet out of them.

There's gonna be like 50 different sprites in this game so I don't think you want to be turning all those into sheets for me. :-)

SavePixmapPNG(). its in the docs.


Yes yes. I saw that Max supports saving PNG. But I'd have to code some kind of windows interface for such an app unless I wanted to make something that would just load specific filenames. It would take me less time to paste the images by hand in photoshop.

Ya want something done right, ya gotta do it yourself!

I buckled down and wrote a stupidly simple sprite sheet maker. It only loads PNG files and outputs a 24bit PNG file with alpha called spritesheet.png.

To use it, make a directory and stick the program in it. Then make subdirectories with your various aliens or what have you, with the files for that alien in the alien's subdirectory.

Then run the program and click the directory in the file selection box.

The program will then read all the PNG's in the directory, and using the size of the first, and the number of PNG's, make a square PNG with all the smaller PNG's in it called spritesheet.png in the same directory as the program. Then just rename that and run the program again for each directory.

I would have named the sprite sheets after the subdirectories but there wasn't a five second way for me to implement that so I didn't.

Anyway here's the code if anyone else needs it:

	Global FileList:TList = CreateList()
	Global PM:TPixmap, PM_Final:TPixmap
	

	' Open a file dialog so the user can select a directory.
		Path$ = RequestDir("Select a Folder", CurrentDir())


	' Attempt to open the directory for reading.
	' If we fail, exit the program.

		Dir = ReadDir(Path$)
		If Not Dir Then End


	' Get the filename of each PNG file in the specified directory.
	
		Repeat
	
			T$ = NextFile(Dir)
		
			If T$ = "" Exit
			If T$ = "." Or T$ = ".." Continue
		
			If ExtractExt$(T$) = "png" Then FileList.AddLast(Path$ + "" + T$)
		
		Forever

		CloseDir Dir


	' Sort the list of filenames in alphanumeric order.
		SortList(FileList, True, CompareStrings)


	' Get the total number of pixmaps we're dealing with.
		Count = FileList.Count()
		

	' Calculate the number of rows and columns we need in the contact sheet to fit this many pixmaps while having an image as close to square as possible.
	' (Assuming PNG's are square.)
	
		Rows = Sqr(Count)
		If Rows*Rows < Count Then Rows = Rows + 1
		

	' Get the size of the first image.  We assume this is the size of all the PNG's.
		PM = LoadPixmapPNG(String(FileList.First()))
		
		CelWidth  = PM.Width 
		CelHeight = PM.Height
		

	' Calculate the width and height of the final image.
		FinalWidth  = CelWidth * Rows
		FinalHeight = CelHeight * Rows


	' Create the pixmap we're going to paste all the other pixmaps into.
		PM_Final = CreatePixmap(FinalWidth, FinalHeight, PF_RGBA8888)
		

	' Paste the small pixmaps into the big one.
		
		For File$ = EachIn FileList
			
			DebugLog(File$)
			PM = LoadPixmapPNG(File$)

			PM_Final.Paste(PM, X*CelWidth, Y*CelHeight)
			
			X = X + 1
			If X = Rows 
				X = 0
				Y = Y +1
			EndIf
			
		Next
		

	' Save the final pixmap, with maximum compression.
		SavePixmapPNG(PM_Final, "spritesheet.png", 9)
	
		
' ------------------------------
' This function compares two strings and returns true if string 1 is greater than string 2, using alphabetical order.
' ------------------------------

	Function CompareStrings(O1:Object, O2:Object)
		Return String(O1) > String(O2)
	End Function


Why do you want it to be square? PNG should get better compression if they're all on a single line (it uses RLE).

I installed it on my dad's system and it screwed it up so bad I had to reinstall everything.

That's pretty odd, considering that on it's own, .NET doesn't do anything.

to install .NET you have to install Service Pack 2

Actually .NET has been available since vanilla XP... or at least SP1.

And to install THAT you have to innstall the windows Geninune Advantage verification tool!

No you don't, just click the 'don't ask me about this update in the future' box, or whatever it's called. WGA is not compulsory - it just can't be removed after you install it.

"Why do you want it to be square? PNG should get better compression if they're all on a single line (it uses RLE)."


Because I don't know how Max deals with the images internally, (does it split them up into seprate textures? I don't know!) and older video cards may require square textures, or may choose to scale the image DOWN rather than up to make it square, and even newer video cards might not like it if you end up with a large boss having an animated image with a width greater than 2048 or 4096.

Also they fit on the screen when you look at them in an image viewer or photoshop so you can look for errors in the images more easily.


As for compression... You do know that images are stored as a long 1D line of bytes in the file, and that as such the end of one line continues to the beginning of the next? You're just as likely to get a run of transparent pixels that way, with the first section being the top line of spirtes 1 2 3 and 4, and the second section being the second line of sprites 1 2 3 and 4, as with putting them all in a single row where the first section would be the top row of sprites 1 2 3 4 .... 16.

And even if it did compress better, the difference is going to be so slight as to not be worth worrying about.

Ignoring all the texture concerns, I'd still rather be able to preview all the sprites on one screen than save 1-2K per image. And as a bonus I get to not worry about whether putting them all in one long line will cause problems.

Doesn't this do it nicely?


I installed it on my dad's system and it screwed it up so bad I had to reinstall everything.



That's pretty odd, considering that on it's own, .NET doesn't do anything.



Here is a page where others describe the "500 Sever error" message that would pop up on the right side of IE every time you'd go to visit a webpage:

http://codebetter.com/blogs/peter.van.ooijen/archive/2003/11/20/3796.aspx

I don't know that the problem occured as a result of installing .net, but it definitely occured when I UNINSTALLED it. Or asp.net... which seems to link to the .net stuff... I don't really know if they're one in the same or not, but I'm going to avoid them both to be safe. :-)



to install .NET you have to install Service Pack 2




Actually .NET has been available since vanilla XP... or at least SP1.




Are you intentionally misquoting me so that you can correct me on something I didn't actually say?

This is what I said:



But to install .NET you have to install Service Pack 2 or the Windows 3.0 Installer.




According to that I didn't say you had to have service pack 2 installed to install .net. I said you had to have service pack 2 installed OR the 3.0 installer, which is correct.



"And to install THAT you have to innstall the windows Geninune Advantage verification tool!"

No you don't, just click the 'don't ask me about this update in the future' box, or whatever it's called. WGA is not compulsory - it just can't be removed after you install it.




What are you talking about? When you go to the .Net developer's page to download the installer, it asks you to run the windows genuine advantage tool. Maybe it's not the same thing you're thinking of, but it asks you to run something to check to see if your copy of windows is genuine. Maybe that's not technically "installing" but my point was you have to download three things and run them just to run your .net app.

"Doesn't this do it nicely?"

I don't know, cause it seems to have to go through the whole tutorial to try it and as I already have a stitching program I don't feel like going through all that just to get something that I don't need.

So guys...

GlueIt is NOT broken!

That shaking problem I was having? It's not the fault of Max or GlueIt. It happens even when I use my own stitching program.

The problem, it turns out, is PHOTOSHOP!

The artist renders out 256x256 frames for me, and I stitch them into a 1024x1024 image, and then scale that down in photoshop to a 256x256 image with 64x64 frames.

I do this because I want the high res versions for the web, and because the resulting image is sharper.

But Photoshop's image scaling is screwy! Even using bilinear scaling, it doesn't combine 4 pixels into 1 the way you would expect it to!

If you output the 64x4 sprites from max and stitch them together, then you get a smoothly animating sprite. But if you overlay the 256x256 image you get from photoshop over that, you'll find it is impossible to get all the sprites to line up! Photoshop is introducing some distortion into the image, possibly to make the resulting image sharper. I don't know. But whatever it is doing isn't bilinear filtering and doesn't produce the desired result.

I guess I will look into maybe making my sheet generator do that scaling, or maybe scaling the images down individually in photoshop before recombining them.

A most unexpected result!

I don't know, cause it seems to have to go through the whole tutorial to try it...

or you could have downloaded the final source?
and as I already have a stitching program I don't

Now, that's a proper objection.
Anyway, I'm surprised so many people offer help in your posts as you have seem to have a gratitude deficiency.

or you could have downloaded the final source?


Obviously I didn't see it. I looked. Briefly. :-)


Anyway, I'm surprised so many people offer help in your posts as you have seem to have a gratitude deficiency.


What do you want from me? :-) I had the artist try GlueIt, and it didn't appear to work. (I only know now that it did.) The other suggestions didn't provide me with working solutions.

I think writing a solution myself and giving it to the community counts as gratitude. And I would have said thanks for GlueIt if it hadn't appeared to be broken initially and required me to install a bunch of stuff.

If you're looking for someone with a gratitude deficiency in the Blitz community, you're barking up the wrong tree. Just because I don't gush thank you with every sentance doesn't mean I don't appreciate the help. And people help me, becayse I help them. I don't expect everyone to thank me everytime I provide assistance. It's appreciated of course. :-) Also, I'm working on three projects at the same time, I'm low on money, owe an artist $1000, and my grandmother just died. So cut me some slack already!

Sorry to hear you're having a hard time of it.
I wasn't suggesting gushing thanks though. Maybe I read your response wrong but it just seemed very dismissive.

This is what I said:

Windows Installer 3.0 only came out after SP2, so that was entirely out of the picture, hence my quote.

When you go to the .Net developer's page to download the installer, it asks you to run the windows genuine advantage tool.

Sorry, my bad. It's never occurred to me to install .NET thru any other means than Windows/Microsoft Update.

you have to download three things and run them just to run your .net app.

OK I don't know which version of .NET to which you are referring to, probably v2 now that I think about it... I think you'll find very little actually uses v2 and v1.1 is considered an entirely different package (MS Update will attempt to have both installed on your machine at the same time). v1.1 installs on SP1 with no Windows Installer updates (ie 2.0 or whatever ships with SP1). The WGA check would still apply.

In any case, you talk as if you have to go thru this for every .NET app there is. You know you're missing out on some very spiffy Blitz related IDEs by not installing this =]

Sorry to hear about your grandmother by the way.

"In any case, you talk as if you have to go thru this for every .NET app there is. You know you're missing out on some very spiffy Blitz related IDEs by not installing this =]"


I prefer the original IDE. :-)

And I know you don't have to install it for each app, but my artist couldn't figure out what this .net thing was that he had to install to get the app to run or where to get it, and I'm sure he's pretty good with computers otherwise. Given that it's obvious a novice computer user would also be at a total loss and your app would just go unused. Hence, BAD IDEA to write apps that use .NET if those apps aren't targetted at programmers, unless you want to include that installer with all your apps.

I'm sure he's pretty good with computers otherwise.

If he doesn't know a 'simple' thing like that, which has existed for 3 or 4 years now... then no, he isn't <grin>

unless you want to include that installer with all your apps.

Most novices that use Microsoft Update would have it installed... Anyways I don't care to learn how to program for .NET... I just like to be able to use things I want to use ;]

Most apps don't require .NET. In fact, GlueIt is the only app I've ever tried to run that requires it. If I came across it all the time I would have installed it.

Plus he's french.