resize (bat) script crash

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?".
Locked
omerdor
Posts: 7
Joined: 2020-03-22T08:14:04-07:00
Authentication code: 1152

resize (bat) script crash

Post by omerdor »

Hi

This is my first post here, so hope my questions is ok.

i found a script that resize pictures Online, I turned it into BAT and tried to run it.

But when I try to run it Immediately collapsed , From what I've been able to see he writes an error that something doesn't exist.

this is the script :

Code: Select all

mogrify -strip -format jpg  *.png
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 50x50 -write Done\\%%[filename:name]_Sma.jpg *.jpg
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 150x150 -write Done\\%%[filename:name]_Med.jpg *.jpg
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 280x280 -write Done\\%%[filename:name]_Big.jpg *.jpg
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 500x500 -write Done\\%%[filename:name]_Enlarge.jpg *.jpg
it didnt see that i do something worng , but its the first time i using IMAGEMAGICK so it is possible that I did not install something good or did somethign else worng .

Thanks .

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: resize (bat) script crash

Post by snibgo »

What version of IM?

I suppose you are using Windows, with a BAT script.

Don't use double backslash "\\" in the filename.
omerdor wrote:From what I've been able to see he writes an error that something doesn't exist.
What is the exact error message?
snibgo's IM pages: im.snibgo.com

omerdor
Posts: 7
Joined: 2020-03-22T08:14:04-07:00
Authentication code: 1152

Re: resize (bat) script crash

Post by omerdor »

hi

i using windows , and the version that i Download is : ImageMagick-7.0.10-2-Q16-x64-dll.exe

And the Error is something like : "file name " is not recognized as an internal or external command , operable program or batch file

but its crash Really fast so i not sure that all

Thanks.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: resize (bat) script crash

Post by snibgo »

How are you running the script?

I suggest you run the script (and any other scripts) by: (1) open a command window, aka command prompt aka console, then (b) type the name of the script and press the return key.

Then you will see any error messages. You can copy-and-paste them here.
snibgo's IM pages: im.snibgo.com

omerdor
Posts: 7
Joined: 2020-03-22T08:14:04-07:00
Authentication code: 1152

Re: resize (bat) script crash

Post by omerdor »

hi

i run it with the cmd and the error was :

'resize' is not recognized as an internal or external command , operable program or batch file .

what can i do to fix it ?

Thanks .

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: resize (bat) script crash

Post by snibgo »

The BAT script that you showed cannot fail with that error.

As you are running IM v7, I suggest you use "magick mogrify" instead of just "mogrify". But that won't cure the error you show.
snibgo's IM pages: im.snibgo.com

omerdor
Posts: 7
Joined: 2020-03-22T08:14:04-07:00
Authentication code: 1152

Re: resize (bat) script crash

Post by omerdor »

hi

i try to change it to "magick mogrify" but it didnt worked .

so what can make this error ?

Do I need to put the photo opening on default of imageMagick ?

Because when i click right click and open with on a picture i cant see open with imagemagick .

Thanks

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: resize (bat) script crash

Post by snibgo »

The BAT script that you showed cannot fail with that error.

Please show your complete script.

Your script contains five commands. Which one has that error? What happens with the other commands?
snibgo's IM pages: im.snibgo.com

omerdor
Posts: 7
Joined: 2020-03-22T08:14:04-07:00
Authentication code: 1152

Re: resize (bat) script crash

Post by omerdor »

hi

this is the full script :

mogrify -strip -format jpg *.png
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 50x50 -write Done\\%%[filename:name]_Sma.jpg *.jpg
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 150x150 -write Done\\%%[filename:name]_Med.jpg *.jpg
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 280x280 -write Done\\%%[filename:name]_Big.jpg *.jpg
mogrify -resize 2000x2000 -extent 2000x2000 -gravity Center -fill white -set filename:name %%t -resize 500x500 -write Done\\%%[filename:name]_Enlarge.jpg *.jpg

as he write in the txt.file i try to run it on the desktop as a batch .

i dont know maybe i need to change the path of the file or something like this , or should i make its batch in other way ?

omerdor
Posts: 7
Joined: 2020-03-22T08:14:04-07:00
Authentication code: 1152

Re: resize (bat) script crash

Post by omerdor »

hi

i try to fixed the problem and now its giveing me this window when i run the script what can i do to fix it :

Image

Thanks for help

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: resize (bat) script crash

Post by snibgo »

It is telling you that "mogrify" isn't installed on your system. As I said upthread, you have v7, so your command should start "magick mogrify".
snibgo's IM pages: im.snibgo.com

omerdor
Posts: 7
Joined: 2020-03-22T08:14:04-07:00
Authentication code: 1152

Re: resize (bat) script crash

Post by omerdor »

hi

i change the start of the command to magick mogrify and now the error says :

Image

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: resize (bat) script crash

Post by snibgo »

You have five commands in that script. All of them tried to call "mogrify" but you don't have that program. You should change all of them to start "magick mogrify".

Ensure you have a space after "magick mogrify" so the first command has a space between "mogrify" and "-strip".
snibgo's IM pages: im.snibgo.com

Locked