Create cross corners frame

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
Mahroun
Posts: 23
Joined: 2011-12-24T02:52:08-07:00
Authentication code: 8675308

Create cross corners frame

Post by Mahroun »

Too difficult for me, sorry
Can someone help me make a command line for ImageMagick that's will create a cross corners frame with edges length relative to the size of the window/picture size?

Here is a screenshot of how I'm doing/programming it now..

Image

Thanks anyway
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create cross corners frame

Post by fmw42 »

This goes a bit further than what you want, but it might give you some ideas.

http://www.imagemagick.org/Usage/thumbn ... e_extended

Alternately, compute the size of the image that needs the border added, use the sizes to compute the end points you want. Then just draw lines using -draw. see http://www.imagemagick.org/Usage/draw/#primitives
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create cross corners frame

Post by fmw42 »

try this, which I modified from http://www.imagemagick.org/Usage/thumbn ... e_extended:


Image

convert -size 1x1 xc:white border.gif
convert thumbnail.gif -matte -bordercolor none -border 34 \
\( -size 144x2 -tile-offset +30+0 tile:border.gif -transpose \) \
-geometry +32+10 -composite \
\( -size 144x2 -tile-offset +45+0 tile:border.gif -transpose \) \
-geometry +154+0 -composite \
\( -size 178x2 -tile-offset +60+0 tile:border.gif \) \
-geometry +0+32 -composite \
\( -size 178x2 -tile-offset +0+0 tile:border.gif \) \
-geometry +10+124 -composite \
thumbnail_frame.gif

Image
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Create cross corners frame

Post by anthony »

Of course in this case the frame is just a solid color, so just adding a transparent border, and drawing the appropriate edge lines will do the job.


For course you can also just overlay the image first then draw the lines too!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Mahroun
Posts: 23
Joined: 2011-12-24T02:52:08-07:00
Authentication code: 8675308

Re: Create cross corners frame

Post by Mahroun »

Thanks for trying fmw42, but the result is not good :(
The left vertical border is missing and the others are not aligned properly.
Also looking at your code it seems that dimensions are being passed which I thought ImageMagick will calculate automatically!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create cross corners frame

Post by fmw42 »

Mahroun wrote:Thanks for trying fmw42, but the result is not good :(
The left vertical border is missing and the others are not aligned properly.
Also looking at your code it seems that dimensions are being passed which I thought ImageMagick will calculate automatically!
You can adjust the dimensions to make it suit. In this code it will not automatically compute the coordinates. To do so you need to write a short script that accesses the images, computes their sizes and draws lines that are some percent bigger.

If you can provide the two images you are using and the placement of the inserted image, then we can probably do that for you. However, I only know bash shell scripting and know nothing about Windows. So if you are on windows, then someone else will need to help.
Post Reply