Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command line batch image cropping tool

is there any lightweight command line batch image cropping tool(Linux or Windows) which can handle a variety of the formats ?

like image 226
iceman Avatar asked Dec 12 '09 12:12

iceman


People also ask

How do I crop a PNG in Linux?

To use ImageMagick to crop, first open the app, or right-click your image and select it from the Open With option. Next, left-click anywhere on the image, and select Transform > Crop. Left-click and drag to create box around the area you wish to crop to, and when you're happy, click Crop.

How do I crop an image in Linux?

Most Linux distributions include the Shotwell application, which you can use to crop photos and perform other basic photo editing tasks. Open the image, click the Crop menu at the bottom or press Control + O on your keyboard. Adjust the anchor then click Crop.

How do you use crop command?

Double-click a shape to select it. Drag within the image to create the shape boundary and move it to the desired location in the image. Click the Commit button , or press Enter to finish the cropping. To cancel the cropping operation, click the Cancel button or press Esc.


2 Answers

In Linux you can use

mogrify -crop {Width}x{Height}+{X}+{Y} +repage image.png 

for CLI image manipulation

like image 187
Ralph Avatar answered Oct 26 '22 10:10

Ralph


Imagemagick's convert does the trick for me (and much more than cropping):

convert -crop +100+10 in.jpg out.jpg 

crops 100 pixels off the left border, 10 pixels from the top.

convert -crop -100+0 in.jpg out.jpg 

crops 100 pixels off the right, and so on. The Imagemagick website knows more:

http://www.imagemagick.org/Usage/crop/#crop

like image 42
Klaus Avatar answered Oct 26 '22 11:10

Klaus