Increase canvas size and montage/tile mirror images

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
qednick
Posts: 2
Joined: 2011-12-08T17:59:21-07:00
Authentication code: 8675308

Increase canvas size and montage/tile mirror images

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Increase canvas size and montage/tile mirror images

Post 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
qednick
Posts: 2
Joined: 2011-12-08T17:59:21-07:00
Authentication code: 8675308

Re: Increase canvas size and montage/tile mirror images

Post 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. :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Increase canvas size and montage/tile mirror images

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply