Why doesn't it work from .bat file via 3rd party program?

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
user989797
Posts: 8
Joined: 2015-08-13T10:52:21-07:00
Authentication code: 1151

Why doesn't it work from .bat file via 3rd party program?

Post by user989797 »

Code: Select all

convert 1.jpg -gravity South  -chop  0x25  2.jpg
Above works when I run the bat file by double clicking manually or when I type in command prompt but it gives an error when I try and run via an automation tooI use. You won't have heard of the tool so I won't mention it :). but it just runs command prompt operations via a process. I will ask over there too if there are no possible answers here but wanted to ask here for common issues cos I doubt they will have the answer there since I had another issue with ffmeg in the past and didnt get the answer there.

Same thing happened when I used ffmpeg once but when I typed in the full path to ffmpeg ie F:\ffmpeg\ffmpeg.exe etc etc then it worked.

So I thought to try that in this case using F:\magic\convert.exe but it still didn't work.

I have the image I want to edit in a seperate folder just called F:\imrun

Any ideas?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Why doesn't it work from .bat file via 3rd party program?

Post by snibgo »

user989797 wrote:... but it gives an error ...
What error does it give?

Are you running this tool in the directory containing 1.jpg? What happens when you "dir 1.jpg" from the tool?
snibgo's IM pages: im.snibgo.com
user989797
Posts: 8
Joined: 2015-08-13T10:52:21-07:00
Authentication code: 1151

Re: Why doesn't it work from .bat file via 3rd party program?

Post by user989797 »

What do you mean by "dir 1.jpg"? The tool doesnt have a command line it is drag and drop operations.

Looking at the error in the command box before it closes I see the error is error loading (imagemagick) module, and file path but I cant get the command box to stay open to tell you the full module that cant load. I will try and get it if it will help?

Yes Im running directly in the dirrectory. The bat file is in the same folder as file 1.jpg.
user989797
Posts: 8
Joined: 2015-08-13T10:52:21-07:00
Authentication code: 1151

Re: Why doesn't it work from .bat file via 3rd party program?

Post by user989797 »

convert.exe: "no decode delegate for this format JPEG"
convert.exe: no images defined

So it seems imgemagick cannot communicate somehow?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Why doesn't it work from .bat file via 3rd party program?

Post by Bonzo »

If it works as in a bat file I would say you do not have an Imagemagick problem and saying "You won't have heard of the tool so I won't mention it" is not that helpful as the problem could be anything. If you told us the name we could look the tool up and see how it works.

What happens if you drop the file over the bat file icon; what exactly do you have in the bat file?

If dragging and dropping, your input filename should be a variable not hard coded. This is one of my batch files:

Code: Select all

convert.exe %1 -thumbnail 200x200 -quality 100 "%~n1.png"
user989797
Posts: 8
Joined: 2015-08-13T10:52:21-07:00
Authentication code: 1151

Re: Why doesn't it work from .bat file via 3rd party program?

Post by user989797 »

Well I ended up doing a mogrify on the batch via command so didnt need to use the other program. :)

The program is:
http://zennolab.com/en/products/zennoposter/

I may want to do it in future (ie run imagemagick on the fly via the other program) but for now I just needed to chop a batch of pics.

Thanks for the help though. Problem averted for now :)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Why doesn't it work from .bat file via 3rd party program?

Post by Bonzo »

You were right, that program link will be no help in sorting the problem out!
user989797
Posts: 8
Joined: 2015-08-13T10:52:21-07:00
Authentication code: 1151

Re: Why doesn't it work from .bat file via 3rd party program?

Post by user989797 »

Ye I wasnt just being awkward :D.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why doesn't it work from .bat file via 3rd party program?

Post by fmw42 »

I would guess that it is your other program that is at issue and perhaps cannot find the JPG delegate it needs.
Post Reply