14

I am working to create a Google group for Ubuntu but one thing I want to do is create the main image that goes in the top (The one that divides into 5 pieces). How can I divide an image horizontally (Or vertically) via Terminal or GUI.

For example I grab an Ubuntu Quantal image and tell a GUI or terminal program to divide the image in 5 equal parts horizontally.

Zanna
  • 70,465
Luis Alvarado
  • 211,503

1 Answers1

15

Install ImageMagick, and then use the command convert:

convert -crop 20%x100% rose.jpg rose2.jpg  

Explanation:

  • 20% is 1/5 of 100% and therefore will crop the image in 5 equal parts.
  • 100% so that it will not be cropped vertically.
  • rose.jpg is the original file.
  • rose2.jpg is the output.
Zanna
  • 70,465
desgua
  • 32,917
  • Thanks for the explanation. Was going to ask about the % before going for the --help of the command. Is there an option to crop it vertically. I would think to first flip it 90 degrees then crop it, then flip it back -90 degrees but maybe there is another way. – Luis Alvarado May 29 '12 at 00:58
  • 2
    Just invert the command 20%x100% to 100%x20%: convert -crop 100%x20% rose.jpg rose2.jpg – desgua May 29 '12 at 01:06
  • Amazing really. Very easy to know and apply. – Luis Alvarado May 29 '12 at 01:12