How to add a title to multiple images
-
- Posts: 3
- Joined: 2017-02-22T13:54:09-07:00
- Authentication code: 1151
How to add a title to multiple images
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
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to add a title to multiple images
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?
What is your IM version and platform/OS?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to add a title to multiple images
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?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to add a title to multiple images
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?
-
- Posts: 3
- Joined: 2017-02-22T13:54:09-07:00
- Authentication code: 1151
Re: How to add a title to multiple images
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.
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.
-
- Posts: 3
- Joined: 2017-02-22T13:54:09-07:00
- Authentication code: 1151
Re: How to add a title to multiple images
LAYERS and TEXT commands are exactly what i need !!
Thanks a lot !
Emmanuel
Thanks a lot !
Emmanuel
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to add a title to multiple images
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:
Or without the image suffix:
see
http://www.imagemagick.org/Usage/montage/
What is your IM version?
Input:
Code: Select all
montage -label "%f" 1-m-javouhey-0907-180x120.png -tile 1x1 -geometry +0+0 1-m-javouhey-0907-180x120_titled.png
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
see
http://www.imagemagick.org/Usage/montage/
What is your IM version?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to add a title to multiple images
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:
IM 6:
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
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