User Input Batch Input to Output Conversion

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
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

User Input Batch Input to Output Conversion

Post by ryanpcworld »

I'm trying to use batch user input for entering the input directory where the images are stored so then you can enter the output directory where your converted files will be.

I tried this, it doesn't work:
SET /P INPUT=Please enter the input directory where your images are stored:
SET /P OUTPUT=Please enter the output directory where your images are going to be stored:
magick convert -path /%INPUT%/.bmp mogrify -dither FloydSteinberg -monochrome /%OUTPUT%/ *.bmp

-Input is outputting a monochrome .bmp to another directory.

Can anyone from the community help me fix the script? I appreciate your response!

Thanks! :D
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: User Input Batch Input to Output Conversion

Post by snibgo »

What version of IM? I assume v7. On what platform? I assumes Windows BAT.

Your command is wrong. "magick convert" needs one input filename and one output filename, without wildcards . Your output filename contains a space. If you really want a space, you should quote the entire filename. But it won't work with a "*".

"mogrify" isn't a valid keyword in "magick convert".

If you want "mogrify", then use "magick mogrify" without "convert". But "mogrify" takes an input filename (with wildcard if you want) and no output filename.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: User Input Batch Input to Output Conversion

Post by fmw42 »

If you are on IM 7, then the new syntax is just magick, not magick convert and not convert; otherwise you get IM 6 processing. For other tools such as identify, mogrify, montage, those must be prefaced with magick.

_________________________

Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

I'm trying to say is the batch file will tell you to enter the directory where your images are stored, then it will tell you which directory you want to save it in. That's what I'm trying to do, I'm using user input like this: http://inanecoding.co.uk/2011/06/simple ... tch-files/
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

I'm also using IM7, I'm also a starter to this forum.
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

Image
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

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

Re: User Input Batch Input to Output Conversion

Post by snibgo »

Your first error message is:

Code: Select all

'mogrify': No such file or directory
This is because
snibgo wrote:"mogrify" isn't a valid keyword in "magick convert".
As it isn't a keyword, IM supposes it must be an image file, so IM tries to find it, and fails.
snibgo's IM pages: im.snibgo.com
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

Image

Done it like this:
SET /P INPUT=Please enter the input directory where your images are stored:
SET /P OUTPUT=Please enter the output directory where your images are going to be stored:
@echo Converting...
magick convert -path /%INPUT%/.bmp -dither FloydSteinberg -monochrome /%OUTPUT%/ *.bmp

Now what?! It's giving me an "unrecognised option."
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: User Input Batch Input to Output Conversion

Post by snibgo »

"-path" isn't a valid option for "magick convert". It is for "magick mogrify". I suggest you change "magick convert" to "magick mogrify".
snibgo's IM pages: im.snibgo.com
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

magick mogrify -path /%INPUT%/.bmp -dither FloydSteinberg -monochrome /%OUTPUT%/ *.bmp
Doesn't work.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: User Input Batch Input to Output Conversion

Post by snibgo »

ryanpcworld wrote:-path /%INPUT%/.bmp
The parameter should be a folder that exists. Do you have a folder that ends with the characters ".bmp"? If not, then remove those characters.
snibgo's IM pages: im.snibgo.com
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

I'm trying to say that I want to make a batch program that will convert images from a input directory to another directory.
At the start, it tells you to input where your bitmaps are stored then enter in the input, and then press enter and it will then ask you to then type in which directory where you want your converted files to be stored, continues on... Press enter and it will convert your bitmaps to monochrome in another folder. I tried your command btw doesn't work! :(
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: User Input Batch Input to Output Conversion

Post by snibgo »

The documentation http://www.imagemagick.org/script/comma ... s.php#path says about "-path":
write images to this path on disk.
So this should be the directory for output, not input. And just the directory, without a filename.
snibgo's IM pages: im.snibgo.com
ryanpcworld
Posts: 9
Joined: 2019-02-19T18:49:31-07:00
Authentication code: 1152

Re: User Input Batch Input to Output Conversion

Post by ryanpcworld »

Yes
Post Reply