Wrapping frame image around a picture?

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

Post by anthony »

Sounds like a good example to add to the 'thumbnails' page for 'extra fluff'
See
http://www.cit.gu.edu.au/~anthony/graph ... ils/#fancy
for an example that is fairly close.

Instead of using border to generate the bulk of the border, you would tile the
image onto a working canvas the right width for your final image, but with the height limited as appropriate, then do the same for the sides.

If you actually come up with a final working example, please submit. for addition to the Im examples page.

Others are also welcome to try. A simple but good example will be used and you name included (unless otherwise desired).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Hmmm... psuedo code...

Code: Select all

read in image

( clone,  viewport crop/flatten to get a image the right height,
     tile over that image with your horizontal edging image  )
(clone last image, flip it for the bottom edge )
swap first two images,  append vertically

repeat the last group but for side edges.

add corners as per 'fancy' example

save result.
The tricky part is getting the images that work together, and matching them up, especially to fit corners.

One solution may actaully like to ensure the added edges are tiles to a whole tile, then resize it slightly (larger or smaller whcih ever is closer to the whole tile) so the tiles match the corner piece properly. All this however make require a much more complex script that calculates the number of tiles needed to fit the image best (rounding up or down for best match).

A generic script would be a useful addition, eg given: image toi edge, and 8 edging tiles (top, bottom, left right edges, plus four corners); it will edge the image as described.

An even fanier version may use edging images with transparency, and masks, and/or 'overlap' info to partically overlay the original image as well.

The 'fancy' example actualy does overlap the image slightly in the orners.

ASIDE: I have added the above to the thumbnail pages at the bottom for your reference and later additions.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Their is no easy way to frame an image with a repeating edge tile pattern.

What I have outlined (particualrly the extended parts for scaling the tiled addition to fit the image better, is probably the best result overall.

The corners are no problem, it is fiiting the repeating pattern into a fixed length that is the problem.

If you have a set of iages you think would make a good frame, present them and I may have a go at writing a script, if I can get any time.

I have some simple framing images at..
http://www.cit.gu.edu.au/~anthony/icons ... Icons.html
but I wouldn't call any of them pretty.

If you know any other such images, please let me know.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

It has not progressed further, though I did put up a 'psudo-code' on what should be done to tile and resize edging tiles so that it will fit with corner pieces.
http://www.cit.gu.edu.au/~anthony/graph ... edge_tiled

If you do work out a script to do this, please share.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply