python rotate image based on text