Added PNG detection to be able to determine at runtime if a downloaded image should be saved as PNG or as JPEG