I've tested it and it works on my machine running CentOS 7 so that the right way to install it. Can you give us the output of yum install libpng and yum provides libpng?
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
yum install libpng
andyum provides libpng
?sudo yum install libpng-devel