php - Cropping an image using Jcrop and Imagemagick -


i'm confused on how -crop function works in imagemagick.

i have following values jcrop.

(x1,y1), (x2,y2), width , height. 

and following command:

exec("convert $target_path -crop ".$w."x".$h."+$x+$y +repage $target_path"); 

original image:

enter image description here

result after crop:

enter image description here

my question is, how used coordinates , dimensions jcrop, , use them imagemagick?

i have no idea values passing convert, command needs extract light region -if aim:

convert x.png -crop 240x240+120+100 out.png 

enter image description here

the first 240 width of cropped area, , second 240 height. 120 x-offset across top-left corner , +100 y-offset down top.

or, in general terms, specify crop this

convert input.png -crop ${x}x${y}+${a}+${b} output.png 

enter image description here


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -