Heyho everyone,
I made a small python script that searches a folder (default "OriginalGamesFiles") and copies all files in all subdirectories to a new folder ("CompressedGameFiles" by default) while converting all .png files to .jpg and replacing all occurences of ".png" in any .html file with ".jpg". All other files are just copied 1:1.
The foldernames can easily be changed in the script in line 5 and 6.
I mostly did this for Havensport, a game made with TWINE if i understood correctly. Could also work for Renpy games, since those just search for filenames without the suffix, right? Could add it, that .py files are also scanned and changed, if some Renpy dev could tell me if this is enough.
Required libs are just "os" and "PIL", not sure if those are pre-installed with Python, but can just be pip-installed easily.
Only issue ive noticed:
Some PNG files are encoded with RGBA (includes transparencies) which in my script are just converted to RGB and then saved as a JPEG, so if transparencies are needed this could cause issues. As i said, i did this for Havensport, and there everything looks the same, the whole game just went from 3GB to 300MB.
If anyone thinks the list of converted filetypes should be added, leave a comment "x to y" and i might add it.
PS: im new to python, so constructive criticism only, if any. No calling me names please, or i'll cry
Greetings and whatnot.
I made a small python script that searches a folder (default "OriginalGamesFiles") and copies all files in all subdirectories to a new folder ("CompressedGameFiles" by default) while converting all .png files to .jpg and replacing all occurences of ".png" in any .html file with ".jpg". All other files are just copied 1:1.
The foldernames can easily be changed in the script in line 5 and 6.
I mostly did this for Havensport, a game made with TWINE if i understood correctly. Could also work for Renpy games, since those just search for filenames without the suffix, right? Could add it, that .py files are also scanned and changed, if some Renpy dev could tell me if this is enough.
Required libs are just "os" and "PIL", not sure if those are pre-installed with Python, but can just be pip-installed easily.
Only issue ive noticed:
Some PNG files are encoded with RGBA (includes transparencies) which in my script are just converted to RGB and then saved as a JPEG, so if transparencies are needed this could cause issues. As i said, i did this for Havensport, and there everything looks the same, the whole game just went from 3GB to 300MB.
If anyone thinks the list of converted filetypes should be added, leave a comment "x to y" and i might add it.
PS: im new to python, so constructive criticism only, if any. No calling me names please, or i'll cry
Greetings and whatnot.