Posts: 3,964
Threads: 107
Joined: May 2008
Is there a tool which analyzes identical sprites (but with different colours) and swaps the palettes?
For example the alternate palettes for Blanka from Super Street Fighter 2:
http://www.spriters-resource.com/snes/su...sheet/5550
Not sure if something like that even exists, but asking shouldn't hurt.
Posts: 3,049
Threads: 60
Joined: Jul 2008
Photoshop can do this pretty easily. I'm guessing there's a few free graphic programs which can a well. But you still have to do it manually (click the colour you want, click the colour you want to replace (it will replace ALL of that colour in every sprite) and so on until you've done them all).
If something which can just do a "compare and replace" function exists I'd be interested in it, as it would be handy and save a bit of time.
This isn't a "whenever you feel like offer" but if there's a palette swap you want pretty desperately I'll be happy to do it if you don't have Photoshop or something (and if no one knows of any piece of software which can do this).
Posts: 3,964
Threads: 107
Joined: May 2008
No problem, I can do this by myself. Still, it's pretty time-consuming, annoying and can produce mistakes.
It would be cool if there's a tool just for easy palette swaps.
07-24-2012, 10:20 AM
(This post was last modified: 07-24-2012, 10:20 AM by puggsoy.)
I was wondering if there was a way to do this too, I think I remember Googling a bit but not coming up with anything. However I haven't needed to do it much so for now I'm content with swapping them manually with GIMP.
However, now that I think about it, a tool for this is probably doable in AS3. If nobody knows of a program that can do this already I'd probably look into making one.
You may have a fresh start any moment you choose, for this thing that we call "failure" is not the falling down, but the staying down. -Mary Pickford
Posts: 3,787
Threads: 75
Joined: May 2008
If you give me like a few days, I might be able to make you such a thing.
I suppose it'd require two identical frames with different palettes to define what shall be changed. Like you define X1, X2, Y1, Y2, Width and Height for positions of two such frames on the sheet, one with palette A, the other with B, and then it'd replace all colors found in frame Awith those from frame B at the same relative pixel position for the whole sheet.
Shouldn't be too hard.
Posts: 3,964
Threads: 107
Joined: May 2008
That would be extremely awesome =D
07-24-2012, 03:32 PM
(This post was last modified: 07-24-2012, 04:19 PM by puggsoy.)
I don't want to kind of push Previous out of the way or anything, but I have had a go at this using ActionScript 3.0 in an Adobe AIR application and it's working OK. What I've done is grabbed 3 sprites, A, B and C from the sprite sheet. A and B are identical, but with different palettes, and C is a whole different frame with the same palette as A. What I can do is change C's palette to that of B by comparing the colours of A and B.
The problem is that this took about 8 seconds, which seems a bit long. If I were to do the entire sprite sheet it'd take ages. I think the problem is that I have to go through every single pixel in the sheet and replace it (unless it's the background colour, which is defined in the program). Unfortunately I don't know of any other way to do it, though.
But then again I don't know if AS3 is fit for stuff like this. Maybe whichever language Previous is using has a more efficient method.
EDIT: Discovered a CPU-wasting flaw in my code and found a workaround. The time it takes to change the palette of C is now just 1 second. Not instantaneous just yet, but it's much faster than before.
You may have a fresh start any moment you choose, for this thing that we call "failure" is not the falling down, but the staying down. -Mary Pickford
Posts: 3,049
Threads: 60
Joined: Jul 2008
Seems cool. Though I was really hoping that "C" would be the "the whole sheet" and not just a single sprite. Unless this is just proof of concept?
07-25-2012, 08:36 AM
(This post was last modified: 07-25-2012, 09:24 AM by puggsoy.)
Well, I already stated that A, B, and C were 3 sprites from the sprite sheet.
(07-24-2012, 03:32 PM)puggsoy Wrote: What I've done is grabbed 3 sprites, A, B and C from the sprite sheet. A and B are identical, but with different palettes, and C is a whole different frame with the same palette as A.
And yes, this is just testing the concept. I tried doing the entire sprite sheet, but even after finding the flaw and bringing the conversion of C down to 1 second, it was taking way too long. However, I got an idea today that could possibly make the conversion of C near-instantaneous, so I'll see how that goes. Although, either way any released version would probably need some sort of progress bar.
EDIT: Ooh yeah, it worked. Changing C's palette is now (practically) instantaneous, and I can convert the entire sheet in 1 second.
You can't see the entire sheet since it doesn't fit in the window but it did convert everything, not only what's visible.
I had a bit of trouble getting it to work though. The thing is that my new method had a different way of comparing palettes. Because of this, if C contained a colour that A didn't, the colour to convert to would simply be black. I discovered this because C happened to have some bits of almost-pure white (a hex value of f8f8f8) on his back and hair, which A didn't contain, resulting in this:
I fixed this by simply skipping colours that weren't present in A, so the white in C stayed. In this sheet that's fine, although in other cases it might not, so the palettes used for comparing should have every colour in the sheet.
You may have a fresh start any moment you choose, for this thing that we call "failure" is not the falling down, but the staying down. -Mary Pickford
Posts: 3,787
Threads: 75
Joined: May 2008
CLASH OF THE TITANS!!
Recolour on my Dropbox.
You can open a file with the folder button or by dropping it onto the large field. You can also just drop it onto the .EXE.
Recolour using the rainbow button, save the result with the diskette.
Also Ctrl+O, Ctrl+S and Ctrl+R (recolour).
Click the image to place the source frame. Shift+click for the destination frame. You can also set the positions using the spin edits at the top where you can also set the size (equal for both, obviously).
(The destination frame has a thicker border in the view.)
My approach was to go through every pixel of the source frame and the destination frame at once, adding each pair to a palette table (which obviously would store every source colour only once). Afterwards, I loop through the whole sheet image pixel by pixel, searching it in the palette and repacing it if the colour was found.
07-25-2012, 03:20 PM
(This post was last modified: 07-25-2012, 03:21 PM by puggsoy.)
That's basically what I did too. You just came up with a GUI before me. *sniff*
Nah, it's cool, probably better than my program anyway. It was educational just trying to make it, though, I learnt a few stuff that I never knew before.
By the way, out of curiosity, what language are you using?
You may have a fresh start any moment you choose, for this thing that we call "failure" is not the falling down, but the staying down. -Mary Pickford
Posts: 3,787
Threads: 75
Joined: May 2008
I came up with the whole algorithm before you
Of course I have a fine GUI what would you expect from me??
I used Delphi Pascal with the Delphi 6 IDE. I wouldn't recommend it to anyone today but I happen to know that one the best.
Also, you go on and finish your program alright? You wouldnÄt want to know what I'd do with you if you didn't.
Yeah, I did base my algorithm off what you said, sorry. I probably would have used that anyway though, it's the most logical way
I'll finish my program, I just dunno what I'll do with it, yours is faster anyway. I might try and fit in some extra features though
You may have a fresh start any moment you choose, for this thing that we call "failure" is not the falling down, but the staying down. -Mary Pickford
Posts: 3,787
Threads: 75
Joined: May 2008
(07-25-2012, 03:50 PM)puggsoy Wrote: I just dunno what I'll do with it You're not supposed to ask this question. Just do it and deal with the formalities later. That just isn't the point.
Posts: 3,964
Threads: 107
Joined: May 2008
07-28-2012, 07:39 AM
(This post was last modified: 07-28-2012, 07:39 AM by Davy Jones.)
What would be cool:
- Recognition of the GIF format
- Loupe Symbol for zooming into the sheet
- Button for Readme and some easy-to-understand explanations
Also, what are these two red dots doing? Can I choose the sprite with them?
|