This replaces the two unpushed patches from my previous set. Includes changes based on Pekka's comments: Removed merging of 1-letter boolean switches Fixed the error message for image files less than 4 bytes long Style fixes. Split patch for library from patch to demo program.