How to split a very long (=height) image into 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
Posts: 24
Joined: 2012-07-02T00:32:10-07:00
Authentication code: 13

How to split a very long (=height) image into parts?

Post by bensto » 2017-09-08T21:57:59-07:00

Sometimes I print some very loooooooong webpages into a *.PNG picture.

Since the height of the resulting image is larger than ~ 32000 pixels a lot of image viewer and image editors cannot handle it correctly.

So I have to split it into several chunks.

Lets say I have such an image file "myhugepic.png".
How can I split the image after a height of 30000 pixels (width remains as original) and put the first part into a new picture file myhugepic001.png.
The remaining image parts should be stored acccordingly into image files myhugepic002.png, myhugepic003.png,....

How would an approrpirate command with ImageMagick look like?

Thank you

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

Re: How to split a very long (=height) image into parts?

Post by snibgo » 2017-09-08T22:30:41-07:00

Code: Select all

convert myhugepic.png -crop x3000 +repage myhugepic%03d.png
This creates multiple outputs, each 3000 pixels high except the last, which may be not as tall.
snibgo's IM pages:

Post Reply