Page 1 of 1

Image resizing via .bat file

Posted: 2016-05-12T08:14:09-07:00
by stvofficial
Hello everyone!
Can you help me with code, that will resize image to 1440*1440 px? Thanks!

Re: Image resizing via .bat file

Posted: 2016-05-12T09:34:19-07:00
by fmw42
What do you want to happen if the input image is not square? Imagemagick can force the output to be square, but that may distort the image if it was not originally square. So you need to decide if you want to crop or pad. See the sections below http://www.imagemagick.org/Usage/thumbnails/#creation.

Please always provide your IM version and platform? We assume you are on Windows if you mention .bat files.

Please read the very top-most post on this forum at viewtopic.php?f=1&t=9620 IMPORTANT: Please Read This FIRST Before Posting

Re: Image resizing via .bat file

Posted: 2016-05-12T09:40:31-07:00
by stvofficial
All the time I gona have square images for resize.
I'm using "ImageMagick-7.0.1-Q16".
My platform is Windows.

Re: Image resizing via .bat file

Posted: 2016-05-12T09:43:20-07:00
by stvofficial
fmw42 wrote:What do you want to happen if the input image is not square? Imagemagick can force the output to be square, but that may distort the image if it was not originally square. So you need to decide if you want to crop or pad. See the sections below http://www.imagemagick.org/Usage/thumbnails/#creation.

Please always provide your IM version and platform? We assume you are on Windows if you mention .bat files.

Please read the very top-most post on this forum at viewtopic.php?f=1&t=9620 IMPORTANT: Please Read This FIRST Before Posting
All the time I gona have square images for resize.
I'm using "ImageMagick-7.0.1-Q16".
My platform is Windows.

Re: Image resizing via .bat file

Posted: 2016-05-12T10:02:25-07:00
by fmw42
The basic command is

Code: Select all

magick image -resize 1440x1440 result
If you want to resize all images in a folder, then

Code: Select all

magick mogrify -resize 1440x1440 *
but that will overwrite your input images. So create a new empty directory and add -path path2/newdirectory to put the output in that directory. See http://www.imagemagick.org/Usage/basics/#mogrify

Sorry, I am not a Windows user and only script in unix bash shell.

Re: Image resizing via .bat file

Posted: 2016-05-12T10:21:08-07:00
by stvofficial
fmw42 wrote:The basic command is

Code: Select all

magick image -resize 1440x1440 result
If you want to resize all images in a folder, then

Code: Select all

magick mogrify -resize 1440x1440 *
but that will overwrite your input images. So create a new empty directory and add -path path2/newdirectory to put the output in that directory. See http://www.imagemagick.org/Usage/basics/#mogrify

Sorry, I am not a Windows user and only script in unix bash shell.
It says to me that: "magick: unable to open image 'image': No such file or directory @ error/blob.c/OpenBlob/2691."

Re: Image resizing via .bat file

Posted: 2016-05-12T11:22:26-07:00
by fmw42
You have to insert your own "image" path and filename there and specify your own "result" path and filename

For new users, see:

http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/
http://www.imagemagick.org/Usage/reference.html

and for windows users

http://www.imagemagick.org/Usage/windows/

Re: Image resizing via .bat file

Posted: 2016-05-12T11:25:26-07:00
by stvofficial
fmw42 wrote:You have to insert your own "image" path and filename there and specify your own "result" path and filename
Ah damn, thanks :D

One more question - is anyway to paste image on image? Thanks

Re: Image resizing via .bat file

Posted: 2016-05-12T11:27:04-07:00
by fmw42
If you want to overlay one image onto another, see

http://www.imagemagick.org/Usage/layers/
http://www.imagemagick.org/Usage/compose/

Code: Select all

magick backgroundimage foregroundimage -gravity XX -geometry +X+Y -compose over -composite resultimage
see
http://www.imagemagick.org/script/comma ... hp#gravity
http://www.imagemagick.org/script/comma ... p#geometry

See my links above also

Re: Image resizing via .bat file

Posted: 2016-05-12T12:23:17-07:00
by stvofficial
fmw42 wrote:If you want to overlay one image onto another, see

http://www.imagemagick.org/Usage/layers/
http://www.imagemagick.org/Usage/compose/

Code: Select all

magick backgroundimage foregroundimage -gravity XX -geometry +X+Y -compose over -composite resultimage
see
http://www.imagemagick.org/script/comma ... hp#gravity
http://www.imagemagick.org/script/comma ... p#geometry

See my links above also
Thanks a lot!