Page 1 of 1

Adding Duplication Padding to Tile Sheet [Resolved]

Posted: 2013-11-15T19:25:01-07:00
by poohshoes
Hey Guys,

I need to take something like this (though it might have more tiles in either direction):
Image

And pad where the tiles touch with a duplicate pixels in the row or column that touches:
Image

Zoomed In Versions:
Input:
Image
Output:
Image

For this 2x2 example the output is two pixels longer and wider then the original. Those extra two pixels are used to add and extra row and column to each tile where it borders the other tiles. I have a script that made this same buffer but using transparency but I have no idea how to go about duplicating part of an image. What commands can I use to do this, any ideas how it might be done?

Thank you,
poohshoes

Re: Adding Duplication Padding to Tile Sheet

Posted: 2013-11-15T20:30:05-07:00
by fmw42
Several ways.

1) you can crop a row and append it (see http://www.imagemagick.org/Usage/crop/#crop and http://www.imagemagick.org/Usage/layers/#append )

2) you can use a viewport with -filter point -distort SRT 0 see http://www.imagemagick.org/Usage/distor ... t_viewport

Re: Adding Duplication Padding to Tile Sheet

Posted: 2013-11-15T21:34:16-07:00
by poohshoes
Thank you fmw42, Distort was exactly what I needed.

Here's the final script:

Code: Select all

convert filledSpaceInput.png ^
 -crop 32x0 +repage ^
 -define distort:viewport=34x64-1-0 ^
 -filter point ^
 -distort SRT 0 +repage +append ^
 -crop 0x32 +repage ^
 -define distort:viewport=68x34-0-1 ^
 -distort SRT 0 +repage -append ^
 output.png
This forum is so helpful!