YesNoOk
avatar

scale XY (Read 5412 times)

Started by Bastard Mami, February 13, 2008, 09:03:52 pm
Share this topic:
scale XY
New #1  February 13, 2008, 09:03:52 pm
  • ******
  • [E]
    • Mexico
as some of you might know, i have been working on a upscale filter; here is the latest-thrid version. the filtering proccess by itself is the same as the second version, the only advantage of this one is improved batch processing and more importantly, you can scale from any size from 0.1 to 2.0. this was done mainly to "fix" the cps ratio sprites by scaling them to 2.0 in Y and 1.66 in X. the sprites must be in png format and index 0 should be the transparent color, and it requires .net.

http://rapidshare.com/files/93181502/scaleXY_b.rar
Last Edit: February 24, 2008, 08:58:49 pm by R[E]ika
Re: scale XY
#2  February 19, 2008, 03:44:31 pm
  • ******
  • Limited time to use Infinite power !
    • France
    • network.mugenguild.com/cybaster/
The program doesn't work exactly how it's intended to work : I can rescale to 2,2, to double the size, but when I try to use floating values, it sends back an error. I also tried with "," instead of "." to put the floating value, and the output is, well, not what I was waiting for. :P

Also, may I have more information on what algorithms you're using to rescale the sprites (how do you chose how to fill the gaps if you double the size ? what sort of interpolation are you using ? are you using any edge detection or this kind of stuff ? etc.) ?
Re: scale XY
#3  February 19, 2008, 06:04:40 pm
  • ******
  • [E]
    • Mexico
woot a reply !

ok first thing first.
http://rapidshare.com/files/93181502/scaleXY_b.rar

This fixes a bug with y scaling, because 1.5 row did not mean to the rescaling algorythm, to round up the row, but rather, would tdisplace the pixels (hard to explain in plain english, but if you try it in the old version it's easy to see what happens). i noticed it yesterday while trying to scale aska's sprites to 1.25 in Y.

now, to answer the other questions i will go with a fast explanation of the previous filters including this one.

i had been scaling sprites for a while, while doing double res spriting experiments, first used to do pixel resize, then retouch over it. after a few ones i discovered/was told of scale2x, and started using it instead as it required less retouching work in my part.

later, i decided to make my own filter; since scale 2x and diagonal detection have fast implementations and are used to filter images to be on screen i decided to take a different approach and make a slow filter that would output the higer quality images possible. the only way i would think of doing that is making the filter scale the sprite in a normal way, then apply fixings as i would fix it normally.

the first version was coded in sdl, the way it works is enlarging the canvas, and for sprite "accuracy" motives it put one pixel from the source in just one pixel in the target; while the surrounding pixels are filled with the transparent color.
looking at it as an array of indexes something like:

1 1   
3 4

gets expanded to

1 0 1 0
0 0 0 0
3 0 4 0
0 0 0 0

this process remains for the next versions of the filter.

after doing the expanding, it then proceeds to scan the image looking for pixels that follows certain rules, and proceeds to "subfilter" the few pixels that comply; an example would be x equal, if it finds a transparent sprite surrouned by two sprites of the same color , it makes the transparent pixel the same color as the surrounding pixels. so.

1 0 1 0
0 0 0 0
3 0 4 0
0 0 0 0

becomes

1 1 1 0
0 0 0 0
3 0 4 0
0 0 0 0

this version has 8 or so subfilters and reads which filter it should use froma  config.txt file.

the second version is virtually the same except ported to .net and with added batch conversion,
the biggest change is that the subfiters are hardcoded and not read from a config.txt; this version was made for extended beta testing as my sdl coding was inconsistent over diferent video cards.

the third version which is the one in this topic is very similar to the previous one but it now adds variable X and Y scaling, because some of my beta testers who reported good results with the previous filter were working with cps sprites, and haivng to scale them back to .80 in X would ruin most of the progress made by the filter. functionality wise, it maps one pixel from the source sprite to one pixel of the target-hi res-ed sprite while leaving holes, and uses the previous subfilters to fill in the holes. since the subfilters were meant for 2x they won't do anything if an image gets scaled to more than 2x.

i have plans for a 4th version and this third version is actually only transitive and to fix some bugs.

for the fourth version i plan to add more subfilters, taking into account even more spriting situations, but more importantly, i plan to implement genetic algorithms, which in some way goes back to the first version's config file. The way they would work is making a filter based on sets of subfilters, oiutput result sprites, then inbreed the filters that give out the best results until a plateau is reached.

i hope i have answered most of your doubts on the project. the newest upload contains source code for sharp develop, though you can open mainform.cs and look at the important code.
Re: scale XY
#4  February 19, 2008, 06:18:56 pm
  • ****
  • Angry Molesting Tree
  • Auf gehts ab gehts 3 Tage wach
    • Germany
    • cenobite53.mugengermany.com/
Sounds interesting, but one stupid question:

Quote
first, you need to get .net support
What is .net support  ???
look at my sprite rips  HERE
look at my TMNT Project HERE
My Contribution to mugen: Stages: 897 | Chars: 8 | Fullgames: 1 | Spritesheets: 85
Re: scale XY
#5  February 19, 2008, 06:31:52 pm
  • ******
  • [E]
    • Mexico
oh don't wory, it is the coding platform. it should be unimportant form an user's perspective, since now even video card drivers require you to have .net installed.

vyn

Re: scale XY
#6  February 19, 2008, 07:06:26 pm
  • ****
    • Mexico
    • armandojc3@gmail.com
so this scales better than pro software? like photoshop or paint shop pro? or is it like a simple option so peeps dont have to use those softwares? maybe some examples??
Re: scale XY
#7  February 19, 2008, 08:04:35 pm
  • ******
  • [E]
    • Mexico
photoshop and paint shop pro use either pixel resize which is not helpful or other mens of interpolation that ruin the palette.
Re: scale XY
#8  February 19, 2008, 10:18:31 pm
  • **
 ???
I could not have increased xscale = 0.83 yscale = 1.07 to a sprite either, is process late very much? When I do it in rezise alone it me works in increasing to 2scalae  and in other measures not.

help me!
Re: scale XY
#9  February 19, 2008, 10:29:45 pm
  • ***
so i can use this to double or half the size of a sprite and not ruin the pallette? and nt get any bluryness?

EDIT: after giving this a test i think it works quite fine althought as u said the image may need a lil bit of reworking after resizing but it does a much better job then photoshop and such. nice work i thanks u for this now i can resize those cvs sprites that are for some reason ripped smaller then the char they are intended for lol
Last Edit: February 19, 2008, 10:46:04 pm by M:ken
Re: scale XY
#10  February 19, 2008, 11:45:50 pm
  • ******
  • [E]
    • Mexico
???
I could not have increased xscale = 0.83 yscale = 1.07 to a sprite either, is process late very much? When I do it in rezise alone it me works in increasing to 2scalae  and in other measures not.

help me!

try the version i posted in my latest post, inside the bin / debug folder should be another exe file that properly supports flaot values for y scaling.