implemented StringIO instead of tempfile for image depiction