Page 1 of 1

Increase canvas size and montage/tile mirror images

Posted: 2011-12-08T18:21:49-07:00
by qednick
Hi all, I'm really struggling with this one... essentially I need to know the best (most efficient) command line way of doing this:

1) Increase the canvas size by a set amount or percentage
2) Vertically flip both the top and bottom sections of the original image to fill the top/bottom canvas area.
3) Horizontally flip left and right sections to fill the canvas.

Rather than trying to explain it in detail, I'm including some before and after pics (which I did in Gimp) to show what I'm trying to achieve:

BEFORE:
Image

AFTER:
Image

Incidentally, I'm on Linux (or OS X) using IM version 6.2.2-6

Any pointers or help with this would be greatly appreciated as I have a ton of images to process.

Thanks!!
Nick

Re: Increase canvas size and montage/tile mirror images

Posted: 2011-12-08T19:44:19-07:00
by fmw42
Use -distort SRT 0 with a viewport set to expand and mirror the image.

The following makes the image bigger by 10% by mirroring the borders on each side by 5%:

convert 60510291.jpg -virtual-pixel mirror -set option:distort:viewport '%[fx:1.1*w]'x'%[fx:1.1*h]'-'%[fx:.05*w]'-'%[fx:.05*h]' -distort SRT 0 +repage 60510291_tmp.jpg


see

http://www.imagemagick.org/Usage/distor ... t_viewport
http://www.imagemagick.org/Usage/distor ... red_square

or see my script, imageborder, at the link below

Re: Increase canvas size and montage/tile mirror images

Posted: 2011-12-10T09:39:39-07:00
by qednick
Wow! Thank you so much for helping me out with this! I've really been struggling to find the best/correct combination to get the results I needed. :)

Re: Increase canvas size and montage/tile mirror images

Posted: 2011-12-11T23:05:28-07:00
by anthony
You may also like to look at
Thumbnails and Framing, self framing (external) images
http://www.imagemagick.org/Usage/thumbnails/#self_frame

The third example is basically identical but it uses 'edge' instead of mirror, and adds a thin border to separate the frame.