ruby-libgd

GD::Image#crop

img2 = img.crop(x,y,w,h)

Returns a new image cropped from the source.