I am not sure I understand the logic here. The code checks first libpng15 if that fails then checks for libnpng16. Shouldn't  it be the other way around first libpng16 if that fails check for libpng15.

Secondly does the package build for arch with this patch as it does not for opensuse