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?".
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.
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.
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
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.
:: 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*
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.
:: 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*
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.
:: 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"
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.
:: 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!!!