How can I add a different logos to an image in batch with the same filenames?
How can I add a different logos to an image in batch with the same filenames?
Hello All, I just need a bit of help here?
The version of ImageMagick I am using is 7.0.7-27 Q16 x64 and I am on Windows 10
This is what I currently have made, Their just simple boxes I have created. (I'm no Photoshop expert obviously)
What I want to do is add a logo to the flattened out spine and do it in a batch process. All the logos have the same file names as the flattened boxes. So I basically want to combine the two. Basically create a bat file that will add the all my logos with the same file name as the flattened out covers with the same file name. The logos are also different sizes so I imagine they would have to be treated as labels so they fit correctly?
I would really like to get this done so any help would be greatly appreciated!!
This is what the box looks like like stretched out:
This is the Logo I want to add to the stretched out image:
And this is the result I am looking for:
The version of ImageMagick I am using is 7.0.7-27 Q16 x64 and I am on Windows 10
This is what I currently have made, Their just simple boxes I have created. (I'm no Photoshop expert obviously)
What I want to do is add a logo to the flattened out spine and do it in a batch process. All the logos have the same file names as the flattened boxes. So I basically want to combine the two. Basically create a bat file that will add the all my logos with the same file name as the flattened out covers with the same file name. The logos are also different sizes so I imagine they would have to be treated as labels so they fit correctly?
I would really like to get this done so any help would be greatly appreciated!!
This is what the box looks like like stretched out:
This is the Logo I want to add to the stretched out image:
And this is the result I am looking for:
Last edited by Robin55 on 2018-05-14T16:01:28-07:00, edited 2 times in total.
Re: How can I add a logo to an image in batch?
This is as close as I have got:
for %%F in (Spine\*.png) do magick composite -rotate -90 -geometry +31+105 "Spine\%%~nF.png" "Front Covers\%%~nF.png" "Covers\%%~nF.png"
for %%F in (Spine\*.png) do magick composite -rotate -90 -geometry +31+105 "Spine\%%~nF.png" "Front Covers\%%~nF.png" "Covers\%%~nF.png"
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How can I add a logo to an image in batch?
i do not believe you can rename output in mogrify. You should consider using a script to loop over your image with convert in IM 6 or use a multi-image solution in IM 7
Re: How can I add a logo to an image in batch?
Hi fmw42,
I don't want to rename the output, the two files I'm combining would have the same filenames and so would the file that is output.... hopefully
Anymore help with this would be very appreciated?
I don't want to rename the output, the two files I'm combining would have the same filenames and so would the file that is output.... hopefully
Anymore help with this would be very appreciated?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I add a logo to an image in batch?
This problem, like so many, can be split into:
1. Decide the image processing required.
2. Decide the looping requirements.
For 1: You don't need "magick composite". Instead, I suggest "magick ... -composite".
The space on the spine is approximately 50x533 pixels. So the rotated logo has to fit into that size. This is:
The ">" prevents small logos from being enlarged. But you might not want that.
So the basic IM command is:
Then put that in a for loop as you have done, using %%~nF with the appropriate dirctories for the two inputs and output.
1. Decide the image processing required.
2. Decide the looping requirements.
For 1: You don't need "magick composite". Instead, I suggest "magick ... -composite".
The space on the spine is approximately 50x533 pixels. So the rotated logo has to fit into that size. This is:
Code: Select all
-rotate 90 -resize "50x533>"
So the basic IM command is:
Code: Select all
magick ^
vi2x6a.png ^
( 20gjf43.png -rotate 90 -resize "50x533>" ) ^
-gravity SouthWest -geometry +28+30 -composite ^
x.png
snibgo's IM pages: im.snibgo.com
Re: How can I add a logo to an image in batch?
Thank you SO much snibgo!! I don't have time right now to test this out, but I'll let you know how I got on as soon as I can. I never would of worked all that out
Re: How can I add a logo to an image in batch?
Is this what you mean snibgo? I can get this working for individual files like your first example, but I'm not able to get it going in batch? can you help me fix this?
magick ^
"Front Covers\%%~nF.png" ^
( "Spine\%%~nF.png" -rotate 90 -resize "50x533>" ) ^
-gravity SouthWest -geometry +26+80 -composite ^
"Covers\%%~nF.png"
magick ^
"Front Covers\%%~nF.png" ^
( "Spine\%%~nF.png" -rotate 90 -resize "50x533>" ) ^
-gravity SouthWest -geometry +26+80 -composite ^
"Covers\%%~nF.png"
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I add a logo to an image in batch?
Yes, but you need "for ... in ... do ..." at the start:
Code: Select all
for %%F in (Spine\*.png) do magick ^
"Front Covers\%%~nF.png" ^
( "Spine\%%~nF.png" -rotate 90 -resize "50x533>" ) ^
-gravity SouthWest -geometry +26+80 -composite ^
"Covers\%%~nF.png"
snibgo's IM pages: im.snibgo.com
Re: How can I add a logo to an image in batch?
Sorry snibgo but its still not working for me, when I run the .bat file all I get is a file named: ^ I tried removing the ^ on the last line and the first line but it hasn't made a difference...what am I missing???
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I add a logo to an image in batch?
Do you get any error messages?
Check you don't have any spaces after the ^ line-continuation-character.
Please paste your exact command here.
Check you don't have any spaces after the ^ line-continuation-character.
Please paste your exact command here.
snibgo's IM pages: im.snibgo.com
Re: How can I add a logo to an image in batch?
Yes I defiantly have no spaces after the ^ in the bat file.
This is the code:
for %%F in (Spine\*.png) do magick ^
"Front Covers\%%~nF.png" ^
( "Spine\%%~nF.png" -rotate 90 -resize "50x533>" ) ^
-gravity SouthWest -geometry +26+80 -composite ^
"Covers\%%~nF.png"
This is the code:
for %%F in (Spine\*.png) do magick ^
"Front Covers\%%~nF.png" ^
( "Spine\%%~nF.png" -rotate 90 -resize "50x533>" ) ^
-gravity SouthWest -geometry +26+80 -composite ^
"Covers\%%~nF.png"
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I add a logo to an image in batch?
When I create the three directories and put PNG files in the first two, it works fine for me.
Does your BAT file contain anything else? If it does, remove it until you get the IM stuff working.
Check what files you have. What is the output from:
Insert this before the for loop:
This should list the files in Spine\.
Does your BAT file contain anything else? If it does, remove it until you get the IM stuff working.
Check what files you have. What is the output from:
Code: Select all
dir "Front Covers"
dir "Spine"
dir "Covers"
Code: Select all
for %%F in (Spine\*.png) do echo %%~nF
snibgo's IM pages: im.snibgo.com
Re: How can I add a logo to an image in batch?
I have checked my files they are 2 .png files in Front Covers, 2 .png files in spines. if I insert
for %%F in (Spine\*.png) do echo %%~nF
I get the same results, the command line looks like its working but nothing is output apart from the file named: ^
I don't know if this is any use but when I run the bat directly from a cmd window I get the error message
' "Front Covers\%%~nF.png" ' is not recognized as an internal or external command
Thanks for your time and patience so far snibgo
for %%F in (Spine\*.png) do echo %%~nF
I get the same results, the command line looks like its working but nothing is output apart from the file named: ^
I don't know if this is any use but when I run the bat directly from a cmd window I get the error message
' "Front Covers\%%~nF.png" ' is not recognized as an internal or external command
Thanks for your time and patience so far snibgo
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How can I add a logo to an image in batch?
I suppose you mean: when you run that command directly from the CMD line instead of in a BAT script. Yes, the doubled %% is needed only for BAT scripts. At the command line they should be single %.wrote:... when I run the bat directly from a cmd window ...
I don't know what else to suggest. Perhaps simplify the magick command, eg:
Code: Select all
for %%F in (Spine\*.png) do magick ^
"Front Covers\%%~nF.png" ^
"Covers\%%~nF.png"
Code: Select all
for %%F in (Spine\*.png) do magick ^
"Front Covers\%%~nF.png" ^
"Spine\%%~nF.png" ^
-gravity SouthWest -geometry +26+80 -composite ^
"Covers\%%~nF.png"
Code: Select all
for %%F in (Spine\*.png) do magick ^
"Front Covers\%%~nF.png" ^
( "Spine\%%~nF.png" ) ^
-gravity SouthWest -geometry +26+80 -composite ^
"Covers\%%~nF.png"
snibgo's IM pages: im.snibgo.com
Re: How can I add a logo to an image in batch?
Ok so I tried all your codes and everyone of them produced a file named: ^
However if I put your code all in one line and remove the ^ I do get a result though the spine.png is placed in the bottom right corner and is not where it should be....
do you think you could show me how to write the code properly all on the one line? thanks again for your help so far!
However if I put your code all in one line and remove the ^ I do get a result though the spine.png is placed in the bottom right corner and is not where it should be....
do you think you could show me how to write the code properly all on the one line? thanks again for your help so far!