Page 1 of 1

How to add a title to multiple images

Posted: 2017-02-22T14:06:35-07:00
by emmanuel_bettler
Hi,
i've a collection of painting (~80 files). For each file, i'll like to add the painting title as a white banner at the bottom of the painting.
So i planned to: convert painting title text into a picture (same width of the original painting) and then merge the 2 files.
For 80 files, i would like to do it with command lines...
Any idea to help me ?

thanks,

Emmanuel

Re: How to add a title to multiple images

Posted: 2017-02-22T14:08:18-07:00
by fmw42
Is your white banner going to make the image taller or will it cover part of your image a the bottom? There are a number of ways to do either.

What is your IM version and platform/OS?

Re: How to add a title to multiple images

Posted: 2017-02-22T14:10:22-07:00
by fmw42
Is the painting title going to come from the image name or meta data label? Or is it independent so that you have to compose it for each image?

Re: How to add a title to multiple images

Posted: 2017-02-22T14:11:16-07:00
by fmw42
Can you upload and example image to some place such as dropbox.com and put the URL here and explain where you want the title and where the title text comes from?

Re: How to add a title to multiple images

Posted: 2017-02-22T14:13:35-07:00
by fmw42

Re: How to add a title to multiple images

Posted: 2017-02-22T14:32:01-07:00
by emmanuel_bettler
The painting title will come from the image name.
From a file, i need to extract the name (from the filename and i know how to do that with python script) and the image width. Then i've to create a white banner with the same width and a predefine height and put the filename in it. Finally, i need to merge the new file with the painting file (without covering a part of the paint).
For some examples: http://marie.javouhey.free.fr/images/to ... 80x120.png or http://marie.javouhey.free.fr/images/to ... 40x110.png or http://marie.javouhey.free.fr/images/to ... 50x160.png
For the OS: Windows or Linux, i've both.
Thanks for your help FMW42.

Re: How to add a title to multiple images

Posted: 2017-02-22T14:34:48-07:00
by emmanuel_bettler
LAYERS and TEXT commands are exactly what i need !!
Thanks a lot !

Emmanuel

Re: How to add a title to multiple images

Posted: 2017-02-22T15:27:30-07:00
by fmw42
Here is one simple way for which you can do multiple images all at one time. (But if you have too many images for your memory size, then you should write a script to loop over each image and process one at a time.) If you need further refinement of the title, then a different approach will be needed. This syntax is common to both UNIX and Windows. If in a .bat file, then % needs to be doubled to %%

Input:
Image

Code: Select all

montage -label "%f" 1-m-javouhey-0907-180x120.png -tile 1x1 -geometry +0+0 1-m-javouhey-0907-180x120_titled.png
Image

Or without the image suffix:

Code: Select all

montage -label "%t" 1-m-javouhey-0907-180x120.png -tile 1x1 -geometry +0+0 1-m-javouhey-0907-180x120_titled2.png
Image


see
http://www.imagemagick.org/Usage/montage/


What is your IM version?

Re: How to add a title to multiple images

Posted: 2017-02-23T12:04:31-07:00
by fmw42
Another way to do this per image is using -append. Adjust the width you want for the text by changing 0.8 (at 1 it will fill the full width of the image)

IM 7:

Code: Select all

magick 1-m-javouhey-0907-180x120.png -set option:name "%t" -set option:wd "%[fx:0.8*w]" \
\( -size "%[wd]x" -gravity center label:"%[name]" \) -append 1-m-javouhey-0907-180x120_titled3.png
Image


IM 6:

Code: Select all

declare `convert 1-m-javouhey-0907-180x120.png -format "name=%t\nwd=%[fx:0.8*w]" info:`
convert 1-m-javouhey-0907-180x120.png \( -size ${wd}x -gravity center label:"$name" \) \
-append 1-m-javouhey-0907-180x120_titled4.png
Image