DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Ko Takagi
Ko Takagi

Posted on

Using Imagemagick to easily split an image file

convert command of ImageMagick is very useful to split an images file.

To use the convert, you'll need to install ImageMagick beforehand.

brew install imagemagick
Enter fullscreen mode Exit fullscreen mode

Split the image to the left and right

input.png

Alt Text

convert -crop 50%x100% input.png output.png
Enter fullscreen mode Exit fullscreen mode

output-0.png

Alt Text

output-1.png

Alt Text

Split the image to the top and bottom

input.png

Alt Text

convert -crop 100%x50% input.png output.png
Enter fullscreen mode Exit fullscreen mode

output-0.png

Alt Text

output-1.png

Alt Text

Split the image into 4 parts

input.png

Alt Text

convert -crop 50%x50% input.png output.png
Enter fullscreen mode Exit fullscreen mode

output-0.png

Alt Text

output-1.png

Alt Text

output-2.png

Alt Text

output-3.png

Alt Text

Top comments (0)

Layoffs: It’s Okay to Not Be Okay