basecurve tool: fix PPM header reading code for PPMs generated by recent imagemagick

As spotted by eildert.groeneveld@gmx.de, it seems convert now outputs slightly different PNM files that were causing trouble to our current PPM header parsing code.