[DISCUSSION] 128x128 pixels Tibia sprites with AI (neural network)


Active Member
Jan 31, 2015
Reaction score
quoting the Linux creator: "Talk is cheap, show me the code".

@mrianuraa gesior has provided a step by step on the process and even shared his repo with functions to load png directly.
What have you done besides this? Did you packed back to spr just to reduce the size?

Just to be clear, feature is in WIP status and will be at least for one more week. I'm a freelancer and Dip Set hired me to develop that feature.
I can not share for free that code without his without his permission. I can describe steps to reproduce such effect:

As an initial step:
1a. Extract .spr file to .png folder (with alpha) -> 32x32 folder
2a. put new 32x32 sprites to 32x32 folder
2. Iterate trough all files in 32x32 folder and resize it using waifu2x neural network -> 64x64 folder
3. iterate through 64x64 images and optimize them (in our case size reduction from 1.55GB to ~350MB) -> 64x64_opt
4. Iterate through all mask sprites (outfit masks in 64x64_opt) and fix them (colors on the edges are a bit changed) -> fixed_images
5. merge 64x64 folder with fixed_images
6. Packing to 2 buffers (a metadata buffer [file size, offset, name] and data buffer[file's data])
7. Iterate through 64x64 folder -> read file data and push to data buffer -> construct metadata and push to metadata buffer
8. create .mpak file (metadata + data flushed binary to file)
9. optionally (in our case adds encryption and reduces pack size to ~260MB) pack to zip file

Our client's sprite manager was changed in such a way, that is able to use spr.zip


------ my YT canal: