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

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.