If you are saving an image as PNG with transparency then saving it as a PNG-8 will give it transparency in the same way GIF has, but that won't work with this function.
For this function to work the image needs to have an alpha channel (obviously really when you think about it), so make sure you save as PNG-24