As always when it comes to image editing, ImageMagick provides a solution, as explained here. The "convert" command is used to crop images with the following syntax:
convert -crop (width)x(height)+(horzOffset)+(vertOffset) infile outfile
where (horzOffset) and (vertOffset) denote the pixel coordinates of the upper left corner of the cropping window (sideways, down). The parentheses are not included in the syntax. Example:
convert -crop 1800x1597+700+0 im1.png imCropped.png
crops im1.png to size 1800x1597, with 700 horizontal offset and 0 pixels vertical offset. To do the same from Matlab, simply use the "system" command:
> system('convert -crop 1800x1597+700+0 im1.png imCropped.png')
0 comments:
Post a Comment