LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-22-2005, 09:23 PM   #1
fractal_chaos
Member
 
Registered: Aug 2003
Location: long island, ny
Distribution: RH, SuSE, FC
Posts: 59

Rep: Reputation: 15
Question Command Line Image Editing


Hello all:

I have a script that generates an image which I distribute to co-workers each day. I would like to place the company logo in the corner of this image, but can only do so AFTER the image has been created.

I've been re-searching the plethora of image processing tools that Linux can use, but haven't found something that helps me do what I want to do. Namely, overlay two images via the command line with some geometry control (i.e. where the logo gets placed).

Maybe I'm missing something? Anyone have a hint/suggestion about this?

Thanks!

-matt
 
Old 09-22-2005, 09:56 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
i don't really know for sure but you might be able to do that with python imaging library
http://www.pythonware.com/products/pil/
 
Old 09-23-2005, 01:21 AM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
ImageMagick has several goodies like mogrify, composite and convert. I used convert in these examples.

The first two examples actually make another image where the text will reside. The two images are joined by the -append command.
It's important to enclose the text in single quotes if it has a word string like 'Not Now'

You will need to play with size and position as I was using a small image.
Code:
convert xc:white -resize 100x20! blank.png |\
convert -append tux.png blank.png tmp.png |\
convert tmp.png -gravity south -font helvetica -pointsize 15 \
-fill blue -draw "text -20+0 Cockatoo" tux1.png

convert xc:white -resize 100x20! blank.png |\
convert -append tux.png blank.png tmp.png |\
convert tmp.png -gravity south -font helvetica -pointsize 15 \
-fill red -draw "text -20+0 'Not Now'" tux2.png

convert tux.png -gravity center -font helvetica -fill blue \
-draw "text 0+5 Cockatoo" tux3.png

convert tux.png -font Helvetica -pointsize 15 -fill red \
-gravity center -draw "text 0+0 'Not Now'" tux4.png

Last edited by homey; 09-23-2005 at 01:30 AM.
 
Old 10-03-2005, 02:32 PM   #4
fractal_chaos
Member
 
Registered: Aug 2003
Location: long island, ny
Distribution: RH, SuSE, FC
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks!

ImageMagick worked mint. I used the following ...

$ convert -flatten old.gif logo.gif new.gif

to place "logo.gif" in the upper-left hand corner of the original image "old.gif" and form a new image "new.gif"

-matt
 
Old 10-03-2005, 04:18 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
Glad it worked for you! I hadn't even thought that your logo was a gif and not just text.
Now if I can just figure out how to move that gif around like I do with -gravity for text.
 
Old 10-03-2005, 04:31 PM   #6
fractal_chaos
Member
 
Registered: Aug 2003
Location: long island, ny
Distribution: RH, SuSE, FC
Posts: 59

Original Poster
Rep: Reputation: 15
right. i hadn't figured the moving part out either, but i guess the default is upper-left, and that worked nicely, so i left it alone...
 
Old 10-03-2005, 05:27 PM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
I am able to change it by using composite to positions north, south, east, west and center. Also, you can combine most of them but center which acts alone.
For example: northeast or southeast.

There doesn't seem to be any fine tuning of position like I did with text and convert.
For example: -gravity northwest -draw "text 0-10 'Not Now'"

So here's what I came up with using composite
Code:
composite -gravity southeast logo.gif earth.png earth1.png
 
Old 10-03-2005, 05:30 PM   #8
fractal_chaos
Member
 
Registered: Aug 2003
Location: long island, ny
Distribution: RH, SuSE, FC
Posts: 59

Original Poster
Rep: Reputation: 15
Yes, that works mint! Thanks...
 
Old 10-03-2005, 05:33 PM   #9
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
Thumbs up

You're welcome!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scheme interpreter w/ command-line editing nazdrowie Programming 1 12-03-2004 08:20 AM
vi style command line editing in gnuplot 3.7 sirclif Linux - Software 0 09-20-2004 12:47 PM
editing XF86Config from command line flum Linux - Newbie 4 09-10-2003 04:12 PM
command line editing eddcrossman Linux - Newbie 7 02-16-2003 07:37 PM
Editing files at command line Goatdemon Linux - Newbie 15 08-12-2002 11:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration