Mogrify doesnt work in .bat-file. What to do?

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

Re: Mogrify doesnt work in .bat-file. What to do?

Post by fmw42 »

I actually just need 1 command now:
To convert all "xxx.2x" data´s to xxx data´s with the right size. (The folder can be the Input folder it´s fine.)
You cannot rename files in mogrify. For that you will need to write a script to loop over each image in the directory and process with convert rather than mogrify. Or use mogrify as above and then rename all the resulting files using your OS commands for renaming.
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

fmw42 wrote:I think you need to cd to the directory your images are in. Then use the -path option to mogrify to specify the output directory. Then use just * at the end. You may be able to use *@2x*.png. I am not sure of that, but I am pretty sure you cannot have a directory specified that way. You need to use -path for the output directory.
This actually isn´t possible. I want to reupload it on my "userpage" after. And it´ll be a free upload for the game "osu". So it need to work for any downloader. Specificaly cd /path" won´t work for me.

That´s my "MAIN"-problem.
If i go for a specific path it doesn´t work for all, only for me.
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

So i guess a need to write a script for it... I beleive it´s a small one but i need to watch some vid´s for it..
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

fmw42 wrote:You cannot rename files in mogrify. For that you will need to write a script to loop over each image in the directory and process with convert rather than mogrify. Or use mogrify as above and then rename all the resulting files using your OS commands for renaming.
Maybe i creat 2 files then. 1 for the outpath. And 1 for the Outpath mogrify resize.
Last edited by MomentumHunt91 on 2015-08-03T18:32:42-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify doesnt work in .bat-file. What to do?

Post by fmw42 »

You need to script a batch file to allow you to cd and use an arbitrary path. That is not an IM issue. That is a batch scripting issue. Sorry I cannot help with that. But perhaps a Windows IM user may be able to help or give you pointers.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify doesnt work in .bat-file. What to do?

Post by fmw42 »

MomentumHunt91 wrote: Maybe i creat 2 files then. 1 for the outpath. And 1 for the Outpath mogrify resize.
I do not understand. You only need a path to the input directory and to the directory to hold your resized output images. They both have to exist for mogrify to work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify doesnt work in .bat-file. What to do?

Post by fmw42 »

Sorry I know nothing about your game issues. That also is not an IM issue.
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

fmw42 wrote:You need to script a batch file to allow you to cd and use an arbitrary path. That is not an IM issue. That is a batch scripting issue.
Ye that´s fine. I´m actually not that good with it i still learn with batch-files. I wouldn´t ask if it it´s not so....:p

Well i got a bit confused by all this informations right now.
Can u give me the command "for the arbytrary path". Would be awesome.

Thanks for all your help by the way!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify doesnt work in .bat-file. What to do?

Post by fmw42 »

Sorry I cannot help with that. I am not a Windows user nor Batch scripter. I only work on a Mac/Unix. But perhaps a Windows IM user may be able to help or give you pointers.

Please read the Windows IM link I mentioned before. Perhaps it will help you.
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

fmw42 wrote:Sorry I know nothing about your game issues. That also is not an IM issue.
Yes the prob is i get no error-log for you so i just can explain it.
My only problem was all the time that the pictures i copy won´t get -50% size the rest works.
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

fmw42 wrote:Sorry I cannot help with that. I am not a Windows user nor Batch scripter. I only work on a Mac/Unix. But perhaps a Windows IM user may be able to help or give you pointers.

Please read the Windows IM link I mentioned before. Perhaps it will help you.
It´s okay just much thanks to you. You was still a big help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify doesnt work in .bat-file. What to do?

Post by fmw42 »

What us your mogrify command now.
mogrify -format png -path full_path_to\output_directory -resize 50%% *
In batch, your %% is correct. But in a CMD window, you only need one %, as I understand it. But I am no expert on Windows.
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

fmw42 wrote:What us your mogrify command now.
mogrify -format png -resize 50%% *
In batch, your %% is correct. But in a CMD window, you only need one %, as I understand it. But I am no expert on Windows.
Yes I use it for my batch with %%. But it doesn´t work like my screen at the beginning. I try it out fast with 1 % gimme a second.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify doesnt work in .bat-file. What to do?

Post by fmw42 »

try using the following in a CMD Window by typing or pasting the command (with a single %) after you cd to the input directory

Code: Select all

mogrify -format png -path full_path_to\output_directory -resize 50% *

Does that work?
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

Re: Mogrify doesnt work in .bat-file. What to do?

Post by MomentumHunt91 »

fmw42 wrote:try using the following in a CMD Window by typing or pasting the command (with a single %) after you cd to the input directory

Code: Select all

mogrify -format png -path full_path_to\output_directory -resize 50% *

Does that work?
For me it doesn´t work i do something wrong here i guess can´t be else. Tried with 1 % and with 2.
http://img5.fotos-hochladen.net/uploads ... c6date.png Something wrong?
Last edited by MomentumHunt91 on 2015-08-03T18:58:18-07:00, edited 5 times in total.
Post Reply