gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > my batch resize -w- anti-alias util preserves sprite edges

#154057 - SevenString - Thu Apr 10, 2008 5:21 am

I wrote a batch graphics utility that does a few useful things for me re. processing of sprites.

One is a custom sort of process that is only really useful in the context of my uber-custom character animation code.

Basically, I have "dynamic" sprites, where unique image sizes are allowed for each frame of animation at runtime, and the utility does all the hard work of cropping and packaging a folder full of sprites into code and data so that my animation system can use them.


But I ALSO have a flag that let's me do a batch resizing of a folder full of images to any target resolution, WITH anti-aliasing. Most importantly, it intelligently preserves the sprite edges. I can take any higher resolution sequence of images, and batch convert them to smaller, anti-aliased images, suitable for sprites because they have NO funky magenta edge colors.


I want to gauge the community interest in such a utility before I go to the trouble of packaging this up for public consumption.
_________________
"Artificial Intelligence is no match for natural stupidity."

#154063 - silent_code - Thu Apr 10, 2008 9:57 am

sounds cool! :^)

ps: no funky magenta edges? ;^p

#154084 - sgeos - Thu Apr 10, 2008 7:54 pm

Sounds neat.

-Brendan

#154087 - gauauu - Thu Apr 10, 2008 9:08 pm

I agree. I've wanted to do this numbers of times, and have gotten very angry at my graphics tools when I can't find a good way of doing it.

#154089 - SevenString - Thu Apr 10, 2008 9:38 pm

Sounds like there's some interest, so I'll go ahead and put together an informal release, and follow up with a link in a couple of days.
_________________
"Artificial Intelligence is no match for natural stupidity."

#154156 - sgeos - Sat Apr 12, 2008 12:53 am

If this tool is written to work with your display system, will the display system be available too?

-Brendan

#154159 - SevenString - Sat Apr 12, 2008 1:47 am

Okay, here's a link to a zipped up version of the utility. You need the .NET 2.0 (or greater) framework installed to run it.

GameBtch


I recommend that you use this as an image processor, and not for generating code with the "-code" flag.

This "-code" flag only works when "-crop" is enabled for generating variable sized frames, and is only intended to produce data for my custom animation system anyway.

The "-bin" flag is temporarily disabled, but that shouldn't be an issue, considering similar tools already exist. ;)


But besides the whole "resampling your sprites without blurring the edges with the background color" thing, this utility also lets you output your frames as an 8bit sequence with a common palette.

Yeah, shared palettes is pretty normal stuff, but one cool additional feature is that you can pre-load your palette with colors that you consider "important". It's an option that allows you to preserve certain colors or subtleties in shading that might otherwise be lost in such an automated color reduction system.


As for releasing the runtime animation code, I'll probably do that at some point when I feel like it's clean enough for public consumption.


Anyway, I can't promise I'll support this tool, since it was really just done for my own internal work, but if anyone does find it useful, and it saves someone some time and effort, then that would be pretty cool. ;)

Enjoy.

p.s. please read the "readme" file, and then look at the "samples.bat" for examples of how to use.
_________________
"Artificial Intelligence is no match for natural stupidity."


Last edited by SevenString on Fri Apr 25, 2008 7:22 am; edited 3 times in total

#154322 - SevenString - Mon Apr 14, 2008 7:16 pm

Update: I made some minor improvements and re-enabled binary (-bin) output.

Also, a trailing back-slash IS required for the output folder. Unfortunately, the example usages in the sample batch file did NOT have these trailing back-slashes. The examples are now fixed, and my apologies if anyone couldn't get this to work because of the broken examples.

GameBtch
_________________
"Artificial Intelligence is no match for natural stupidity."


Last edited by SevenString on Fri Apr 25, 2008 7:22 am; edited 1 time in total

#155126 - SevenString - Fri Apr 25, 2008 7:21 am

Update: color quantization is now done via median cut for much faster, much nicer looking results.

Also, there's now support for 16 color output (-4bit).



Latest GameBtch
_________________
"Artificial Intelligence is no match for natural stupidity."

#155234 - nsm333 - Sun Apr 27, 2008 12:23 am

sounds cool. can i have a look at that code? sounds like it would help.