Reorganize the PNG conversion script to make it more maintable and portable

This commit rewrites the build-pngs.sh script to make a number of improvements.

Firstly it allows the script to choose a different conversion command depending
on the users environment.  It now supports either using rsvg-convert directly
or using ImageMagick convert.  rsvg-convert is used directly in preference of
convert.

Secondly it refactors the script to make the conversion a function and call that
function several times.  This is more readable and allows for easily adding
conversion of new folders with a single line change to the script.