Adding a horizontal stripe to an image?

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
ClumsyNinja
Posts: 5
Joined: 2013-09-21T18:38:31-07:00
Authentication code: 6789

Adding a horizontal stripe to an image?

Post by ClumsyNinja »

ImageMagick-6.8.3-Q16

How would I either :

Add a horizontal black stripe, centered vertically, to an existing image?

or

Add the stripe to an image at the time of creation (I'm using convert to create)

Either is fine. I figure I can create all the images and then use *.gif to add the stripe afterwards, or if possible, add the stripe to the image when I create it.
Last edited by ClumsyNinja on 2013-09-22T11:48:51-07:00, edited 1 time in total.
ImageMagick-6.8.3-Q16 automated with MJTnet Macro Scheduler v14.
Windows 8 64 bit. Sony Vaio laptop.
New to ImageMagic, but an old hat at Windows automation.
ClumsyNinja
Posts: 5
Joined: 2013-09-21T18:38:31-07:00
Authentication code: 6789

Re: Adding a horizontal stripe to an image?

Post by ClumsyNinja »

So it looks like adding afterwards might be the easiest. Composite looks very simple.

Code: Select all

composite -gravity center  pic1.gif  pic2.gif  mergedpic.gif
Now I'm off to find out how ho make the stripe. Looks like I only need to create that image once.

I'll post my findings here, if nobody replies in the meantime.
ImageMagick-6.8.3-Q16 automated with MJTnet Macro Scheduler v14.
Windows 8 64 bit. Sony Vaio laptop.
New to ImageMagic, but an old hat at Windows automation.
ClumsyNinja
Posts: 5
Joined: 2013-09-21T18:38:31-07:00
Authentication code: 6789

Re: Adding a horizontal stripe to an image?

Post by ClumsyNinja »

What initially appeared to be simple, turned out not to be. I have worked out the solution and will post it here so others may benefit.

I realized that rather than adding a horizontal line over the top of an image, the line needed to be underneath. This is for a simple textual web mouseover button.

So I needed a white background, then a stripe, then on top of the stripe, I needed the text. The solution was staring me in the face.

Start with a blank white image which just contains my yellow stripe, and annotate it.

With Macro Scheduler code

Code: Select all

run program>"%IMexepath%\convert" %IMdocpath%\white-with-stripe.gif -pointsize 12 -gravity west -font Arial-Bold -annotate +4+2 %artistname% -fill black %IMdocpath%\complete-button.gif
Without Macro Scheduler code

Code: Select all

convert c:\white-with-stripe.gif -pointsize 12 -gravity west -font Arial-Bold -annotate +4+2 TEST -fill black c:\complete-button.gif
ImageMagick-6.8.3-Q16 automated with MJTnet Macro Scheduler v14.
Windows 8 64 bit. Sony Vaio laptop.
New to ImageMagic, but an old hat at Windows automation.
Post Reply