even uglier screenshot code (but it keeps proportions!)