Fixed to work with padded CGImages.