Build square thumbnail by cutting off l/r slices


I intend to build square thumbnails by cutting off parts of the image (given the original format is not square). Currently I am using GD for image manipulation.

Let me give you an example:
User image upload is 600x400px. I resize it to 60x40 using imagecopyresampled.

My question is: How can I cut off 10px from the left and 10px from the right, resulting in a nice 40x40px thumbnail?

Thank you very much for your help,

Use Imagemagick :smiley:

I would look at Imagecrop

You may have to do some calculations to pass the positions to the crop function.

FYI: I decided to give the ImageWorkshop Class a try (found on

Thank you,