Back to the snippets index

Crop an image ( Anthony 21/6/2008 )

Crop part of an image.240x180+100+100 = Crop to be 240 wide by 180 high and crop top left hand corner to be 100 across and 100 down.

IM code:

<?php
exec
("convert input.jpg -crop 240x180+100+100 +repage output.png");
?> 

Image to go with Crop an image example code
Clone
Crop an image
Crop an image into pieces
Dividing an image
Keep minimum image size
New image size in variable
Resize if over certain size
Resize keep aspect ratio.
Resize no aspect ratio.
Speed up jpg resize