weakish wrote:I have some difficulties in understanding the usage of negative offsets in geometry.
Code: Select all
convert -crop 50%x100%+0+0 in.jpg out.jpg
convert -crop 50%x100%-0-0 in.jpg out.jpg
give the same result. (Got the left half of the picture.)
Can anyone give some hints? Thanks in advance.
+0+0 and -0-0 both refer to the upper left corner pixel. so you won't see any differences. If you put +20+20, you will have an image that has its upper left corner starting 20 pixels in from your original. Negative offsets will likely crop 20 pixels from the lower right corner and may disregard your size specification, I am not sure. If you want to crop from one side or corner add -geometry and use positive offsets.
see
http://www.imagemagick.org/script/comma ... s.php#crop
Also your syntax should possibly be
convert in.jpg -crop ... out.jpg
See
http://www.imagemagick.org/Usage/basics/#cmdline Although in this case in likely does not matter as your will be cropping as you read the input in your syntax rather than loading the image and then cropping it in the latter syntax (assuming you can use -crop while reading the input).
Also note that after cropping, you want to remove the virtual page information using +repage
convert in.jpg -crop ... +repage out.jpg
see
http://www.imagemagick.org/Usage/crop/#crop