Windows batch convert (newbie)

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?".
Post Reply
mrogovin

Windows batch convert (newbie)

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Windows batch convert (newbie)

Post 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"
zoran1973

Re: Windows batch convert (newbie)

Post 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
mrogovin

Re: Windows batch convert (newbie)

Post by mrogovin »

Thanks to all posters. I am sorry that I did not see the replies earlier.

Michael Rogovin
mrogovin

Re: Windows batch convert (newbie)

Post 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]
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Windows batch convert (newbie)

Post 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
mrogovin

Re: Windows batch convert (newbie)

Post 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)?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Windows batch convert (newbie)

Post 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
mrogovin

Re: Windows batch convert (newbie)

Post by mrogovin »

Yahoo! (no trademark infringement intended. A reinstall worked. Thank you so much!! (sorry about the repost above -- clicked the wrong button).
Post Reply