Page 2 of 2
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-04T14:33:53-07:00
by d7e7r7
Wow, thanks for the quick work... mustve taken you guys a while to write those codes?
I saved the php coding as a .bat file using Notepad but when I drop an image into it nothing happens so I opened it and saw
. Now I dont know this coding thing very well but how can I modify that line to change input to = the file that i drop onto the .bat file?
Another thins is where does the script save the processed file?
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-04T15:00:40-07:00
by snibgo
Here is a version of fmw's script, for Windows. I have added an undercolour, to help legibility.
Code: Select all
set INFILE=twooceansmarathon2494.jpg
convert %INFILE% -format "set WIDTH=%%w\nset CAPTION=%%[EXIF:ImageDescription]" info:cx.bat
call cx.bat
convert %INFILE% ^
( -size %WIDTH%x -background none -font Arial -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite captioned_%INFILE%
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-04T15:21:23-07:00
by snibgo
You can't use PHP code directly in Windows batch files. But here is a batch file you can put on your desktop. Drop an image file on it, and it will create a captioned version in the same drive/directory of the image.
Code: Select all
set INFILE=%1
"%IMG%convert" %INFILE% -format "set WIDTH=%%w\nset CAPTION=%%[EXIF:ImageDescription]" info:cx.bat
call cx.bat
"%IMG%convert" %INFILE% ^
( -size %WIDTH%x -background none -font Arial -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite %~dpn1_captioned%~x1
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-05T02:00:54-07:00
by d7e7r7
snibgo wrote:You can't use PHP code directly in Windows batch files. But here is a batch file you can put on your desktop. Drop an image file on it, and it will create a captioned version in the same drive/directory of the image.
Code: Select all
set INFILE=%1
"%IMG%convert" %INFILE% -format "set WIDTH=%%w\nset CAPTION=%%[EXIF:ImageDescription]" info:cx.bat
call cx.bat
"%IMG%convert" %INFILE% ^
( -size %WIDTH%x -background none -font Arial -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite %~dpn1_captioned%~x1
I made that into a .bat file and dropped an image onto it and it seemed to work but it doesn't create a new file when it finishes. Attached a screen shot:
http://img121.imageshack.us/img121/2830/57980889.png
That screen shot is from the second last command, the last command happens as the cmd dialog closes so I cannot get a screenshot in time

Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-05T02:09:45-07:00
by Bonzo
el_suprimo recomends putting "" around file names to help keep them together and that may be your problem, also the code produces a tempory file which can be removed.
I tend to put the bat file onto my desktop.
Code: Select all
:: Set the variable INFILE equal to the original file name
set INFILE=%1
:: Setup the width of the caption container - the width of the original image - and get the caption text from the EXIF data
:: Saved as cx.bat
"%IMG%convert" %INFILE% -format "set WIDTH=%%w\nset CAPTION=%%[EXIF:ImageDescription]" info:cx.bat
:: Load the cx.bat file ?
call cx.bat
:: Add the caption to the image and save with _captioned at the end of the original filename
"%IMG%convert" %INFILE% ^
( -size %WIDTH%x -background none -font Arial -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite "%~dpn1_captioned%~x1"
:: Delete tempory batch file
echo Y | DEL *cx.bat*
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-05T05:12:57-07:00
by d7e7r7
Bonzo wrote:el_suprimo recomends putting "" around file names to help keep them together and that may be your problem, also the code produces a tempory file which can be removed.
I tend to put the bat file onto my desktop.
Code: Select all
:: Set the variable INFILE equal to the original file name
set INFILE=%1
:: Setup the width of the caption container - the width of the original image - and get the caption text from the EXIF data
:: Saved as cx.bat
"%IMG%convert" %INFILE% -format "set WIDTH=%%w\nset CAPTION=%%[EXIF:ImageDescription]" info:cx.bat
:: Load the cx.bat file ?
call cx.bat
:: Add the caption to the image and save with _captioned at the end of the original filename
"%IMG%convert" %INFILE% ^
( -size %WIDTH%x -background none -font Arial -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite "%~dpn1_captioned%~x1"
:: Delete tempory batch file
echo Y | DEL *cx.bat*
Thanks Bonzo, that coding worked!! created a new file but the caption is pretty illegible, is there a way to make it larger?
See captioned file here:
http://img693.imageshack.us/img693/1386 ... 2125ca.jpg
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-05T05:37:33-07:00
by Bonzo
Give somebody some help and they just want more !
This WIDTH=%%w\nset sets the width variable of the caption box to the width of the image.
( -size %WIDTH%x -background none -font Arial -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite "%~dpn1_captioned%~x1"
-size "caption box size" -background "caption box colour in this case transparent" -font "font to use and you can input the path to a font anywhere on the PC" -fill "colour of the font" -undercolor "clolour behind the font" -gravity " position on the image - think main compass points " -geometry "offset amount from -gravity"
Add a -pointsize 80 and see what it looks like; then go from there.
Code: Select all
:: Add the caption to the image and save with _captioned at the end of the original filename
"%IMG%convert" %INFILE% ^
( -size %WIDTH%x -background none -font Arial -pointsize 80 -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite "%~dpn1_captioned%~x1"
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-05T06:04:30-07:00
by d7e7r7
Bonzo wrote:Give somebody some help and they just want more !
This WIDTH=%%w\nset sets the width variable of the caption box to the width of the image.
( -size %WIDTH%x -background none -font Arial -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite "%~dpn1_captioned%~x1"
-size "caption box size" -background "caption box colour in this case transparent" -font "font to use and you can input the path to a font anywhere on the PC" -fill "colour of the font" -undercolor "clolour behind the font" -gravity " position on the image - think main compass points " -geometry "offset amount from -gravity"
Add a -pointsize 80 and see what it looks like; then go from there.
Code: Select all
:: Add the caption to the image and save with _captioned at the end of the original filename
"%IMG%convert" %INFILE% ^
( -size %WIDTH%x -background none -font Arial -pointsize 80 -fill white -undercolor "#00000080" caption:"%CAPTION%" ) ^
-gravity north -geometry +0+20 -composite "%~dpn1_captioned%~x1"
Sorry for all the trouble, coding just isn't for some people
I managed to find a freeware app that is pretty much a GUI of what you guys are coding (i think?)
http://www.gphotoshow.com/exif-iptc-watermarker.php
Thanks again!!!
Re: Mogrify lightroom plug-in caption problem
Posted: 2010-04-05T07:02:56-07:00
by Bonzo
Give somebody some help and they just want more !
I was only joking.