Include string.h for str{cat,cpy,len,ncpy}
Don't overlink to libpng
Size out_fn buffer correctly when encoding
Respect LDFLAGS
Don't use floating point arithmetic