Fix build issue without gd

build fails without `--with-gd` option