My preferred tool for this operation is Inkscape, where I produce the border in vector format and export it in png format. I can determine the exact pixel size while exporting.
But I understand you want to use a bitmap border, resize it and put it onto your picture, right?
You can't avoid any calculations, only you know the size of the picture and how much you want the border stretched etc.
Have a look at ImageMagick.
http://www.imagemagick.org/script/index.php
With the combine command (
http://www.chemie.fu-berlin.de/chemn...w/combine.html) you can take your bitmap border and combine it with a 45 degrees square picture so you are cutting the ends of your border correctly.
My workflow would be like this, all using
convert and
combine:
- determine the size of the frame I need
- create the largest edge of the frame by combining a number of pieces of my base frame image
- cut the edges in 45 degrees
- duplicate and mirror the longer edge
- duplicate and rotate one edge
- cut the shorter side with 45 degrees
- duplicate and mirror the shorter edge
- combine those for images into one image
The nice thing about this is that it is relatively easy to script. Once you sort out how to determine dimensions and cutting points it works for every image. Aligning is no problem of course.
Bash is not good with non-integer calculations, use
dc for that.
jlinkels