Fixed most of the padding concerns. What is missing, is color conversion if the passed padding color contains more channels than the image itself.