add doctests; fix image_from_buf
cosmetic changes