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
bensto
Posts: 31
Joined: 2012-07-02T00:32:10-07:00
Authentication code: 13

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

Post by bensto »

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
Ben
snibgo
Posts: 12159
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 »

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: im.snibgo.com
Post Reply