sub min($$){ $_[0]<$_[1]?$_[0]:$_[1] } $img->resize(min $gui->width(),$gui->height() / min $img->width(),$img->height());