I happened to have been tasked with a seemingly simple job — split a large image (size A1) into small A4 tiles for draft printing on a standard office laser printer. Couple of minutes of Googling only led to a some online services, either paid (come on, paying for cutting an image?!) or free with limitations on the maximal number of output tiles or on the size of input file.
Anyway, this is what we’ve got (scaled down):
Large Property Solutions banner.
And this is what we want:
Desired cutting marks.
ImageMagick to the rescue
During googling I have also found ImageMagick mentioned a couple of times. ImageMagick, if you don’t know it, is a bit cryptic but very powerful suite of tools for manipulating images.
As it turns out splitting an A1 (9920 x 7016 px at 300 dpi) image into a bunch of A4 (2480 x 3508 px) tiles with this swiss army knife for image manipulations is as simple as:
convert big-image.png -crop 2480x3508 +repage tile-%d.png
In my case I ended up with 8 tiles: tile-0.png
to tile-7.png
, fired up gwenview
, to check it:
Upper-left tile.
All looked good. Then I configured border-less printing and sent it to the printer. And got but the outline:
Outline printout.
No idea why! Tried many different settings, spent about an hour and got nowhere. The only thing that worked was printing to PDF first and then printing that PDF. Still no idea what’s broken but at least I found a workaround.
Split image to PDF
Naturally my next idea was to automate it all and convert the large input image directly to a print-ready multi-page PDF file. And this is what I ended up with split-image.sh
:
It takes any input file format supported by ImageMagick of any size and cuts it to A4 (or whatever output size you configure) PNG tiles, optionally merging them all to a print-ready PDF file.
~$ split-image.sh banner-WBH-A1.png ==== Processing banner-WBH-A1.png, please wait... Done -rw-r--r-- 1 mludvig users 54115 Sep 29 02:31 banner-WBH-A1-tile-0.png -rw-r--r-- 1 mludvig users 44557 Sep 29 02:31 banner-WBH-A1-tile-1.png -rw-r--r-- 1 mludvig users 56254 Sep 29 02:31 banner-WBH-A1-tile-2.png -rw-r--r-- 1 mludvig users 53588 Sep 29 02:31 banner-WBH-A1-tile-3.png -rw-r--r-- 1 mludvig users 115493 Sep 29 02:31 banner-WBH-A1-tile-4.png -rw-r--r-- 1 mludvig users 121955 Sep 29 02:31 banner-WBH-A1-tile-5.png -rw-r--r-- 1 mludvig users 107994 Sep 29 02:31 banner-WBH-A1-tile-6.png -rw-r--r-- 1 mludvig users 97244 Sep 29 02:31 banner-WBH-A1-tile-7.png Convert to PDF? [Y/n]: y ==== Converting to banner-WBH-A1-tiled.pdf, please wait... Done -rw-r--r-- 1 mludvig users 454987 Sep 29 02:31 banner-WBH-A1-tiled.pdf
That’s it. Now I can very easily split whatever image the We Buy Houses / Property Solutions people come up with. Enjoy! (And sell them a house