Stream.py is one of the biggest bottlenecks of this project. While I don't know how to fix it (the last 4 prs addressing it did not have drastic results), this pr at least fixes the problem in KOTOR's biggest files: TGA textures.
Since most of the tools use Pillow anyway it doesn't make sense not to use it if available. This PR will check if pillow can be imported, and if so will use Pillow to load TGA files. If it's not available, fall back to original custom logic. This ensures we don't add unnecessary dependencies to PyKotor.
Stream.py is one of the biggest bottlenecks of this project. While I don't know how to fix it (the last 4 prs addressing it did not have drastic results), this pr at least fixes the problem in KOTOR's biggest files: TGA textures.
Since most of the tools use Pillow anyway it doesn't make sense not to use it if available. This PR will check if pillow can be imported, and if so will use Pillow to load TGA files. If it's not available, fall back to original custom logic. This ensures we don't add unnecessary dependencies to PyKotor.