3

I wanted to resize a batch of Image using ImageMagick.

I used this this command found on stackOverflow.

There are two directory on the same level

  • "img_resize" where I want to put my resized images.
  • "image_models" where there are my images.

I used:

magick mogrify -path "img_resize" -resize 512x512 -gravity Center -extent 512x512 "image_models"

And got:

mogrify: unable to open image 'img_resize': Permission denied @ error/blob.c/OpenBlob/3497.
mogrify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/556.

I tried without using two directory:

cd image_models
magick mogrify -resize 512x512 -gravity Center -extent 512x512

It doesn't show errors; But still didn't do anything.

Therefore, the "convert" command work well. The issue come from mogrify.

I'm using windows 10. I used the Terminal and the Terminal run as Admin.

I also tried with ./dir instead of "dir"

Thanks in advance.

Felox
  • 503
  • 3
  • 10
  • 23
  • 1
    Remove all the unnecessary double-quotes throughout your first command and change the last parameter to `image_models\*` – Mark Setchell Jun 11 '19 at 10:32

1 Answers1

1

If your current directory is the base of your mentioned two folders, use relaive pathes and a wildcard for the source:

magick mogrify -path ".\img_resize\" -resize 512x512 -gravity Center -extent 512x512 ".\image_models\*"

Sample run in A:\Test folder:

> Get-ChildItem -Recurse

Verzeichnis: A:\test

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019-06-11     11:30                image_models
d-----       2019-06-11     11:31                img_resize

    Verzeichnis: A:\test\image_models

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       2018-11-02     22:32         679624 AucklandOneTreeHillIanRushton_01.jpg
-a----       2018-11-02     22:32         529290 AucklandOneTreeHillIanRushton_02.jpg

    Verzeichnis: A:\test\img_resize

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       2019-06-11     11:31          53545 AucklandOneTreeHillIanRushton_01.jpg
-a----       2019-06-11     11:31          50687 AucklandOneTreeHillIanRushton_02.jpg
  • As Mentioned on the topic, I tried to apply the resize without -path argument, and It did not do anything. I'm guessing there is a issue other than the pah. However I tried your command and It did not do anything: img_resize dir is still empty. – Felox Jun 11 '19 at 10:18
  • Without a path the original files are overwritten. Depending on your current directory you need to supply a relative/absolute path with a wildcard. The above code and my described variant both do work here. –  Jun 11 '19 at 10:30
  • And ***WITHOUT*** `-path` argument that will stay so. For my originalworking command the relative pathes rely on being **IN** the common parent of both folders. –  Jun 11 '19 at 11:32