Add support for different aspect ratios

This patch adds support for different aspect ratios of thumbnail and
full-size image. 
The script adapts automatically to the ratio of the full-size image now.