Page 1 of 1

Windows batch convert (newbie)

Posted: 2009-12-04T10:36:43-07:00
by mrogovin
I would like to batch convert several TIF files from a DVD to JPG files on my hard drive (windows xp machine). Can anyone help me write a batch file to do this? My feeble attempts to do this failed. Thanks.

Re: Windows batch convert (newbie)

Posted: 2009-12-04T11:52:48-07:00
by Bonzo
Here is a link to some batch scripts I wrote or modified. I tend to have a batch script on my desktop I darg and drop files into. I am not a batch file expert but this should give you some ideas.
http://www.rubblewebs.co.uk/imagemagick/batch.php
Look toward the bottom of the page; the last example worked but you will need to setup your folder paths and modify what you want IM to do.

This may be all you need:

Code: Select all

::Turn of displaying the code on the screen
@echo off

:: Read all the jpg images from the directory, resize them, add some text and save as a png in a different directory
for %%f in (%1\*.jpg) do ( convert %%f -resize 200x200 -pointsize 18 -fill black ^
-gravity northwest -annotate +0+0 "Some text" "%2\%%~nf.png" )

This batch file was named resize.bat and called using "resize path\to\original\ path\to\save"

Re: Windows batch convert (newbie)

Posted: 2009-12-04T11:58:04-07:00
by zoran1973
i use sed.exe
http://www.student.northpark.edu/pement ... d15exe.zip

dir down\f*.jpg /A-D /B > ~txt.tmp
sed15.exe s/\(f\)\(.*\)\(.jpg\)/convert\x20down\\f\2\3\x20\-crop\x20957x572+5+26\x20-quality\x2090\x20crop\\c\2.tif/g ~txt.tmp >~tmp.bat
call ~tmp.bat

But I think it is easiest usung for command

Re: Windows batch convert (newbie)

Posted: 2009-12-27T10:05:02-07:00
by mrogovin
Thanks to all posters. I am sorry that I did not see the replies earlier.

Michael Rogovin

Re: Windows batch convert (newbie)

Posted: 2009-12-27T10:31:12-07:00
by mrogovin
OK I tried the batch file. If I am doing something wrong, please tell me (something IS wrong since it is not working :-(

@echo off
for %%f in (E:\*.tif) do (convert %%f "C:\Party1A\%%~nf.jpg")

I get the following messages on screen

convert: no decode delegate for this image format 'E:\DSC_0574.TIF' @ constitute.c/ReadImage/530.
convert: missing an image filename 'C:\Party1A\DSC_0574.jpg @ convert.c/ConvertImageCommand/2838.
[the above are repeated for each successive file]

Re: Windows batch convert (newbie)

Posted: 2009-12-27T13:20:57-07:00
by Bonzo
Three things to try:

1/ Run this and see if you get a rw+ next to TIFF - this will tell you if you have tif support

Code: Select all

convert -list Format
2/ Try using on a folder containing jpg files first - this will prove the code works or not

3/ You program may be using the windows convert file, try renaming convert to IMconvert and use IMconvert in your code not convert

Re: Windows batch convert (newbie)

Posted: 2009-12-27T17:13:47-07:00
by mrogovin
This is the result of the test for TIF support:

C:\Documents and Settings\Owner>convert -list Format
Format Module Mode Description
-------------------------------------------------------------------------------

* native blob support
r read support
w write support
+ support for multiple images

C:\Documents and Settings\Owner>

Looks like I am missing support for every format ? Perhaps I installed it incorrectly (though not sure how)?

Re: Windows batch convert (newbie)

Posted: 2009-12-27T17:29:25-07:00
by fmw42
Did you install from source or binary? if from source, you have to install the delegate libraries for the image types you want such as TIFF, PNG, JPG, etc. Then recompile IM.

You can test again by typing

convert -list configure

and see what is listed under DELEGATES.

You can get some old delegates at: http://www.imagemagick.org/download/delegates/ but you may want to google for more current ones.


If you installed from binary, then yes, you probably did not install something correctly or you don't have IM pointing to the right places.

For Windows binary, see http://www.imagemagick.org/script/binar ... hp#windows

For Windows source, see http://www.imagemagick.org/download/www ... ml#windows

Re: Windows batch convert (newbie)

Posted: 2009-12-27T18:06:11-07:00
by mrogovin
Yahoo! (no trademark infringement intended. A reinstall worked. Thank you so much!! (sorry about the repost above -- clicked the wrong button).