Crop images using the shell?
May 23, 2006 10:58 PM Subscribe
Is there a console app for *nix that I can use to crop images?
The images are 640x480. I want to cut them in half horizontally, and then cut each half into four separate images vertically. I know I can do this in gimp, but I'd rather do it quickly using the shell. I'm flexible when it comes to file formats (they're PNGs, but it wouldn't be a problem to mass-convert them all to JPEGs). Bonus points for an app that has Debian or Ubuntu binaries available. Thanks!
The images are 640x480. I want to cut them in half horizontally, and then cut each half into four separate images vertically. I know I can do this in gimp, but I'd rather do it quickly using the shell. I'm flexible when it comes to file formats (they're PNGs, but it wouldn't be a problem to mass-convert them all to JPEGs). Bonus points for an app that has Debian or Ubuntu binaries available. Thanks!
ImageMagick is very easy to use, imo. It is also incorporated into scripts easily. I can't offer any support for NetPBM or Gimp Script-Fu as I have never tried them, ImageMagick has always been more than adequate for my modest needs.
posted by Loto at 11:50 PM on May 23, 2006
posted by Loto at 11:50 PM on May 23, 2006
Best answer: It seems like
Turn on -verbose and you see that it's creating output-0.jpg, output-1.jpg and so on. The original "filename,jpg" chopped into four.
So then I guess you just need to do
This is the convert command of ImageMagick of course.
posted by AmbroseChapel at 3:20 AM on May 24, 2006
convert -crop 640x240 untitled.jpg output.jpgwill do your first part.
Turn on -verbose and you see that it's creating output-0.jpg, output-1.jpg and so on. The original "filename,jpg" chopped into four.
So then I guess you just need to do
convert -crop 160x240 output0.jpg tophalfoutput.jpgand
convert -crop 160x240 output1.jpg bottomhalfoutput.jpgthat is, if I understood what you meant.
This is the convert command of ImageMagick of course.
posted by AmbroseChapel at 3:20 AM on May 24, 2006
Oops.
The original "filename,jpg" chopped into four.
Was meant to be "The original "untitled.jpg" chopped into two"
posted by AmbroseChapel at 3:22 AM on May 24, 2006
The original "filename,jpg" chopped into four.
Was meant to be "The original "untitled.jpg" chopped into two"
posted by AmbroseChapel at 3:22 AM on May 24, 2006
Seconding ImageMagick in general and convert in particular.
posted by primer_dimer at 5:48 AM on May 24, 2006
posted by primer_dimer at 5:48 AM on May 24, 2006
The python imaging library would also work well, and if you know python, you'll likely find it easier to pick up than imagemagick.
posted by gsteff at 9:59 AM on May 24, 2006
posted by gsteff at 9:59 AM on May 24, 2006
This thread is closed to new comments.
posted by tumble at 11:01 PM on May 23, 2006