Reputation: 4049
I'm confused on how the -crop function works in Imagemagick.
I have the following values from Jcrop.
(x1,y1), (x2,y2), width and height.
And following command:
exec("convert $target_path -crop ".$w."x".$h."+$x+$y +repage $target_path");
Original image:
Result after crop:
My question is, How do I used the coordinates and dimensions from Jcrop, and use them with Imagemagick?
Upvotes: 0
Views: 760
Reputation: 4049
I feel like an idiot.
I had style='max-width:500px;' on my image during the crop. Removed the style and now it's working.
Upvotes: 0
Reputation: 207465
I have no idea what values you are passing into convert
, but your command needs to look something like this to extract the light region -if that is your aim:
convert x.png -crop 240x240+120+100 out.png
The first 240
is the width of the cropped area, and the second 240
is its height. The 120
is the x-offset across from the top-left corner and the +100
is the y-offset down from the top.
Or, in general terms, you specify the crop like this
convert input.png -crop ${x}x${y}+${a}+${b} output.png
Upvotes: 1