Closed gregstein closed 4 years ago
Hey Greg, glad you found us!
Our converter puts the frames into a spritesheet by design. If you want to extract every frame individually, you can start editing here:
This normally puts the frames in a list for packing, but you can replace frames.append(subtex)
in line 132 with self.save(self, targetdir, filename, meta_formats=None)
(choose parameters accprding to your needs). This should output each frame one by one.
Hey Greg, glad you found us!
Our converter puts the frames into a spritesheet by design. If you want to extract every frame individually, you can start editing here:
This normally puts the frames in a list for packing, but you can replace
frames.append(subtex)
in line 132 withself.save(self, targetdir, filename, meta_formats=None)
(choose parameters accprding to your needs). This should output each frame one by one.
Heinezen.. Thank you so much I couldn't be more satisfied with your beautiful answer
So i guess we can close this. If not, please report back :)
Hello again,
So i'm struggling with the parameters and how I should run them..
I have tried:
python3 -m openage convert-file --player-palette-file /home/greg/games/aoe2de/Data/playercolor_blue.pal --palette-file /home/greg/games/aoe2de/Data/b_west.pal /home/greg/games /home/greg/rofl.png
Sorry for being a burden on this one as I am still learning python and making progress day in day out.
Thank you so much
The solution is a bit hacky, but it should work. Replace the lines I quoted with this block of code, replace the placeholders for the Directory
path and compile the project again.
frame_ctr = 0
for frame in input_data.main_frames:
for subtex in self._smp_to_subtextures(frame,
main_palette,
player_palette,
custom_cutter):
self.image_data = subtex
frame_name = "frame_%s" % (frame_ctr)
frame_ctr += 1
self.save(Directory("/folder/on/your/system/").root, frame_name)
frames.append(subtex)
I did exactly as you have suggested but im getting "ValueError: Texture image must be created from PIL Image or numpy array, not '<class 'openage.convert.texture.TextureImage'>'"
This is the command used:
python3 -m openage convert-file --player-palette-file /home/greg/game/playercolor_blue.pal --palette-file /home/greg/game/b_west.pal /home/greg/game/u_vil_male_villager_idleA_x1.smx /home/greg/game/rofl.png
And is it necessary to rebuild as in deleting the project then make it again? Because I only used make command to rebuild.
I updated the line with self.image_data = subtex
in my comment above so that it hopefully works now (sorry for the guesswork, I can't test the code myself atm). Using make
to rebuild is fine and the only thing necessary.
That fixed but now I see a new error in your last code edit:
NameError: name 'Directory' is not defined
I think if this is fixed your code will work. Here's how my code look like:
frame_ctr = 0
for frame in input_data.main_frames:
for subtex in self._smp_to_subtextures(frame,
main_palette,
player_palette,
custom_cutter):
self.image_data = subtex
frame_name = "frame_%s" % (frame_ctr)
frame_name += "1.png"
self.save(Directory(Path("/home/greg/frames/").parent).root, frame_name)
Try importing this at the start of the file
from ..util.fslike.directory import Directory
After importing the line i get
raise Exception("incompatible type for path: %s" % type(path_))
Exception: incompatible type for path: <class 'openage.util.fslike.path.Path'>
Please note that I had to change frame_name += 1
to frame_name += "1"
because it returned frame_name must be str.
Removing the Path(..).parent
expression around the string "/home/greg/frames/"
might help.
and it should be frame_ctr += 1
not frame_name += 1
Hmm.. Look in your folder :D
It should have converted the frames individually. The last exception occurs because the frames weren't put in a list at the end. You can fix that by adding frames.append(subtex)
after self.save(..)
again.
You are one hell of a Genius! Though I got an error that 'can't create texture with empty input frame' Still the frames were extracted successfully.
Look at this beauty: Fuck Yeah!!
I'm really sorry for all the trouble you went through to help me out with this.
You made my day really!!! Thank you so fucking much
Have an awesome day brother <3
Hmm.. Look in your folder :D
It should have converted the frames individually. The last exception occurs because the frames weren't put in a list at the end. You can fix that by adding
frames.append(subtex)
afterself.save(..)
again.
How did you know that? LOL... That's insane really you guys are fucking python geniuses and I think studying this library will help me come even little bit closer to being a python mother fucker.
Hello,
I'm new here but notably impressed with this fantastic library such great work tbh. I just have a question if some of you could help.
I extracted the png file out of smx (AoE2 DE):
python3 -m openage convert-file --player-palette-file ~/games/aoe2de/Data/playercolor_blue.pal --palette-file ~/games/aoe2de/Data/b_west.pal u_elite_eagle.smx /tmp/rofl.png
Example:
Now I'm scratching my head to how to convert this spritesheet into frames so I can edit them one by one.
Thank you,