I agree replacement variables will work nicely, although ,this isn't the more efficient way. Replacement variables work well if you wish to have different smilies/post icons for different styles but i would personally edit the extension and modify the appropriate template. Infact, modifying .gifs with colours less than 256 colours will not increase the quality when changing the extension unless you actually design the icons yourself and that icon is more than 256 colours. Then again, it depends on what .png formatted icon your uploading.
The best way is that you design the icons yourself and save the source file to .png and then to modify the extensions within the appropriate template. All the other suggestions are just make do and even then (pending on the quality of the file) you could be changing the extension with no noticeable differences. The .gif file will remain 256 colours or less no matter what extension you change it to.
Anyway, I'll stop rambling and and stop pretending that I know what I'm on about.