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 |
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/ |
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 |\ |
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 |
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. |
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...
|
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 |
Yes, that works mint! Thanks...
|
You're welcome!
|
All times are GMT -5. The time now is 07:05 PM. |