Resizing images actually was broken, how nobody noticed I don't know.

This should fix the issue. (tested using transparent PNG and GIFs)