Insert logo in the photo

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
dominic
Posts: 2
Joined: 2017-03-08T01:38:21-07:00
Authentication code: 1151

Insert logo in the photo

Post by dominic »

Hello to all

I need to use a small logo, such as 50px x 30px at a given point in an image, the files in question are:

photo.png
logo.png

command that should be used for example to insert it in the lower right detaching a little from the edges?es?
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Insert logo in the photo

Post by GeeMack »

dominic wrote: 2017-03-08T01:42:15-07:00command that should be used for example to insert it in the lower right detaching a little from the edges?es?
First, please always provide your IM version and platform. Refer to this topic — Please Read This FIRST Before Posting — at the top of the forum category for instructions on how to post a question to get the most helpful replies.

Using ImageMagic v6, the simplest approach to overlaying one image on another is to do a "-composite" operation something like this...

Code: Select all

convert photo.png logo.png -gravity southeast -geometry +10+10 -composite output.png
The "-gravity southeast" tells it to place the overlay in the bottom right corner. The "-geometry +10+10" tells it to move the overlay up from the bottom and over from the right by 10 pixels in each direction. There are many more settings available to accommodate almost any special requirements you might have. We'd need more details to give you better help.
dominic
Posts: 2
Joined: 2017-03-08T01:38:21-07:00
Authentication code: 1151

Re: Insert logo in the photo

Post by dominic »

Hello, thank you so much response. It 'the first time you use this library, usually I used gd but not having installed php on my PC (using linux) I needed something to terminal to automate the insertion of a logo on the images.

I'm finding out slowly imagemagick and I must say it is fantastic.

I tried your suggestion and it works great. One thing, it would be possible to apply the inclusion of "logo.png" in all the photos in this directory?

There are many, like 100, it would be possible to add it at all? thank you so much.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Insert logo in the photo

Post by fmw42 »

What is your IM version and platform. Please alway provide that since syntax and approach may differ.

Generally you can do that using Mogrify. See
http://www.imagemagick.org/Usage/basics/#mogrify
http://www.imagemagick.org/Usage/basics ... fy_compose

Are all your images the same file format such as PNG in the directory? Is the watermark image a PNG and is it in the same directory. If the watermark image is not a PNG or all your other images are not png, then you can keep the watermark in the same directory. If they are the same, then you need to move the watermark image to a new location.

I would suggest you create a new directory to hold your results from mogrify. Say your images are in folder1 and you have an empty directory folder2. Then

Code: Select all

cd path2/folder1
mogrify -path path2/folder2 -format png -draw 'image over 0,0 0,0 "path2/watermark.png"' *.png
If you want all image types in folder1, then do

Code: Select all

cd path2/folder1
mogrify -path path2/folder2 -format png -draw 'image over 0,0 0,0 "path2/watermark.png"' *
This will make png output images. If you want a different output, then change -format, such as -format jpg. If your watermark image is not png, then change that suffix.

If you are using IM 7, then put "magick" before mogrify.

For novices, see

viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
Post Reply