Struggling with bat in Win7

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
Parduz
Posts: 2
Joined: 2012-10-07T04:05:03-07:00
Authentication code: 67789

Struggling with bat in Win7

Post by Parduz »

Hello from Italy (pls excuse my poor english).

I'm trying to do some tile cropping, but i'm becoming crazy with the bat file.

This is how it is after reading the help and the "using magick in windows":
SETLOCAL EnableDelayedExpansion
convert "%1" -crop 660x500 +repage +adjoin "card_%~n1_%%02d.png"
pause
This is what i get back:
D:\ImmaginiCarte>convert "D:\ImmaginiCarte\01.png" -crop 660x500 +repage +adjoin
"card_01_%02d.png"
Parametro non valido - -crop
(which means "invalid parameter - crop")

I'm sure i've missed something, but i can't figure what. Any help?

Also:
why i can't use pathnames/filename like "D:\== TEMP FOLDER==\ - this is a strange name -\filename"?
It keeps keeping the "minus signs" or the "equals" as parameters...


Oh, using Win7 32 ultimate (italian)
Thanks
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Struggling with bat in Win7

Post by Bonzo »

Windows has a convert program to rename files and sometimes this is what you are running and not the Imagemagick convert program

Have you had Imagemagick running at all in your setup?
Parduz
Posts: 2
Joined: 2012-10-07T04:05:03-07:00
Authentication code: 67789

Re: Struggling with bat in Win7

Post by Parduz »

Well, what it runs if i just type "convert" in a cmd window is IM.
So i'm guessing it is IM also for my bat file.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Struggling with bat in Win7

Post by Bonzo »

Best to check the obvious!

What happens if you remove the SETLOCAL EnableDelayedExpansion
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Struggling with bat in Win7

Post by whugemann »

There is nothing wrong with that batch file. It runs fine on my Windows computer. There is also nothing wrong with setting SETLOCAL at the start of it. So I guess it is some mix-up with the Windows convert command. Rename the IM Convert into something else (e.g. IMconv.exe) and call that program in your batch file instead.

Have you tried to do some other simple convert operation in a CMD box?
Wolfgang Hugemann
indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: Struggling with bat in Win7

Post by indiego »

I have taken this from the draft documentation of my upcoming ConTeXt module.
Hope this helps...

Pitfalls: the 'convert.exe' problem

There is an equal named program on Windows OS, that converts the file system
of a given drive from fat32 to ntfs. If this program is called instead of the IM binary,
you have to edit the $PATH variable.
The entry for IM must stand before the "c:\windows*" entries.

I highly recommend Redmond Path for this job. Editing this long
environment variable by hand is both unclear and cumbersome.

Beware: older Windows versions than Vista need a complete restart of the OS
to make the change happen!

http://www.softpedia.com/get/System/Sys ... Path.shtml
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Struggling with bat in Win7

Post by anthony »

This is one reason why the new command in IMv7 is called "magick".
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply