in reply to resampling an image using GD not working on Linux
Maybe you just need
my $resized = GD::Image->new($small_w || 1, $small_h || 1); [download]