fix writing both kind of figures

split figures into 2 kinds text and binary

fixes #107
Merge pull request #108 from Carreau/binfig

fix writing both kind of figures