Split and image into two equal parts.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Valkarin
Posts: 3
Joined: 2017-12-08T16:40:19-07:00
Authentication code: 1152

Split and image into two equal parts.

Post by Valkarin » 2017-12-08T16:54:38-07:00

Need help. I'm trying to split an image into two parts. The original is 1272x954. I need to split it in half so I get two images that are 636x954. I have tried:

Code: Select all

magick convert out00.png -crop 50%x100% +repage splitleftout%02d.png
and:

Code: Select all

magick convert out00.png -crop 636x954 +repage splitleftout%02d.png
I always get eight images of varying size. Three that are *x848, three that are *x106 and two that are 1x1.

When I try:

Code: Select all

magick convert out05.png -crop 636x954+0+0 +repage splitleftout%02d.png

I get one image that is 312x848 starting at the top left of the original image.

I have looked at the documentation and googled until my eyes hurt. What am I missing/doing wrong?

Also, Im on a windows 10 system if that makes a difference.

snibgo
Posts: 10360
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split and image into two equal parts.

Post by snibgo » 2017-12-08T17:05:03-07:00

You need an "at", "@":

Code: Select all

-crop 2x1@ +repage
This chops it into two pieces horizontally, but only one vertically.

It is documented, at http://www.imagemagick.org/script/comma ... s.php#crop
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 23393
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Split and image into two equal parts.

Post by fmw42 » 2017-12-08T17:09:34-07:00

This should have worked and given only two pieces.

Code: Select all

magick out00.png -crop 50%x100% +repage splitleftout%02d.png
Note in IM 7, magick replaces convert. For other modules such as identify and mogrify, etc., you need to precede them with magick. So magick identify or magick mogrify.

Using magick convert may lead to the use of IM 6 convert rather than IM 7.

Please always provide your exact IM version and platform when asking questions.

Valkarin
Posts: 3
Joined: 2017-12-08T16:40:19-07:00
Authentication code: 1152

Re: Split and image into two equal parts.

Post by Valkarin » 2017-12-08T17:15:32-07:00

Thanks a lot. I saw the @ in the documentation, but didn't understand it.

Post Reply