Solve the bug of Image::saveImageToPNG()

The method Image::saveImageToPNG() can't write png files correctly on platforms without iOS.