Well figured out png functionality; don't comment out your FileControlWriteFile ; instead use below and you should be able to scan to png now :). Clean compile ; I'm on my Sabayon install, so I can't test fully right now as I have trouble getting the scanner to actually detect :P.
**EDIT ...