I need an algorithm that converts normal pixel array images into a customized tile-based texture format used in video games. Requirements: - Optimize a conversion algorithm in a given python script - Input is a normal format pixel array (i.e. RGBA PNG format) - Output in a tile-based texture format, with limited palette size - Needs good output quality (current code produces mediocre quality) - Will provide explanation on current code if needed - Can also develop a completely new algorithm if the current idea is not good enough - Need good documentation Ideal Skills: - Can read and write python code comfortably - Strong background in image processing, especially for tile-based textures - Proficiency in optimization algorithm design