tiling an image at fixed size with "extra" border

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
jedierikb
Posts: 20
Joined: 2012-12-13T13:59:27-07:00
Authentication code: 6789

tiling an image at fixed size with "extra" border

Post by jedierikb »

I want to divide an image into equally sized tiles, and using this command:

Code: Select all

convert -crop 500x500 obama.jpg o_%d.png
It works great. The "extra" slivers at the end are as expected.

However, I want to add 1px more around each tile. The result should be that each adjacent tile has the same overlapping pixels.
(For the edge pieces I would like to add 1px of transparency.)

Is there an easy way 'out of the box' to do this?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: tiling an image at fixed size with "extra" border

Post by fmw42 »

add -background none -extent 500x500 to the end of your command to add the transparency. To get overlapping, if on Linux/MacOSX/Windows with Cygwin, see my script, overlapcrop, at my link below.

You can run the script and pipe the output to another convert to add the transparency.

Or I could possibly modify the script to add the transparency
Post Reply