Batch magnify from a folder to an another one [solved]

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?".
kimono
Posts: 11
Joined: 2019-04-01T01:40:36-07:00
Authentication code: 1152

Batch magnify from a folder to an another one [solved]

Post by kimono »

Hi, I'm totally new here. I use ImageMagick-7.0.8-Q16 on Windows 10.
I wish to use the -magnify command (scale2x filter) to .png files toward an another folder in .png format.

I've got simply two questions:
- Can someone tell me what is the correct command line to do this?
- Can you explain what -minify command exactly does on an image?

Thank you for your help! :)
Last edited by kimono on 2019-04-09T04:06:05-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: Batch magnify from a folder to an another one

Post by fmw42 »

Change directories to the folder where you have your input. Be sure you already have an output directory.

Code: Select all

magick.exe image.png -magnify paphto_output_directory\image.png
There is no minify function according to the commands list at https://imagemagick.org/script/command-line-options.php

If you want a general enlarging or shrinking image command, then use -resize.
kimono
Posts: 11
Joined: 2019-04-01T01:40:36-07:00
Authentication code: 1152

Re: Batch magnify from a folder to an another one

Post by kimono »

@fmw42: Thanks for your answer. I've got a folder with around 100 png images and I wish to magnify all of them in one time to another directory.
How can I do that?
Is -resize (= nearest neighbor? )the best way to shrink an image without having a blurred pixelart?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Batch magnify from a folder to an another one

Post by fmw42 »

1) use mogrify -- it will process all images in a folder and write to a new folder

create a new folder
change directories to the current folder
magic.exe mogrify -path path_to_new_folder -magnify *.png

See https://imagemagick.org/Usage/basics/#mogrify

2) you resize smaller using nearest neighbor as -filter nearestneighbor -resize ...

or

use -sample

see

https://imagemagick.org/script/command- ... php#resize
https://imagemagick.org/script/command- ... php#sample


________________

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
kimono
Posts: 11
Joined: 2019-04-01T01:40:36-07:00
Authentication code: 1152

Re: Batch magnify from a folder to an another one

Post by kimono »

Ok I tested this:

Code: Select all

C:\ImageMagick-7.0.8-Q16>magick.exe mogrify -path Karatedo -magnify *.png
mogrify: UnrecognizedOption `-magnify' @ error/mogrify.c/MogrifyImageCommand/5557.
It seems that the magnify option is not recognized.
Can you tell me what I've done wrong? Thank you :)
Last edited by kimono on 2019-04-03T00:18:57-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch magnify from a folder to an another one

Post by snibgo »

"-magnify" isn't an option for "magick mogrify".
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: Batch magnify from a folder to an another one

Post by fmw42 »

You can request that it be added on the Discourse server. In the meantime you will have to write a loop over all the images you want to process or the images in a folder and use convert or magick to process them depending upon what your IM version is - 6 or 7.
kimono
Posts: 11
Joined: 2019-04-01T01:40:36-07:00
Authentication code: 1152

Re: Batch magnify from a folder to an another one

Post by kimono »

@snibgo: Thanks for the information, I'll search where I can post this request.

@fmw42: I use the latest version of IM-7 and I don't know how to write a loop :/. Can you show me please the global writing?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Batch magnify from a folder to an another one

Post by fmw42 »

Sorry, I do not use Windows. I can show you in Unix, but then you would need to use Windows 10 Unix. Perhaps one of the Windows users here can help you further or do a Google search for .bat scripting.
kimono
Posts: 11
Joined: 2019-04-01T01:40:36-07:00
Authentication code: 1152

Re: Batch magnify from a folder to an another one

Post by kimono »

I retested with an updated version (ImageMagick-7.0.8-38-Q16-x64-dll) and I've got the following message:
"Le client ne dispose pas d'un privilège nécessaire"
"Client does not have a necessary privilege"
I reboot windows 10 and authorized to have a total control with all the files of the Imagemagick folder and the input folder but it doesn't seem to work.
Do you have any clue on how to solve it?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch magnify from a folder to an another one

Post by snibgo »

I don't think that message came from ImageMagick.

What were your commands? Which command produced that message?
snibgo's IM pages: im.snibgo.com
kimono
Posts: 11
Joined: 2019-04-01T01:40:36-07:00
Authentication code: 1152

Re: Batch magnify from a folder to an another one

Post by kimono »

I came from that command line:

Code: Select all

C:\ImageMagick-7.0.8-Q16>magick.exe mogrify -path Karatedo -magnify *.png
Is it because I don't have an output folder? Do you know how I cad add an output to this command line?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch magnify from a folder to an another one

Post by snibgo »

kimono wrote:C:\ImageMagick-7.0.8-Q16>magick.exe
You are in the ImageMagick installation directory, and running the command from there. This is a bad idea. I suggest you create a different directory for your image processing, and change to that directory.

Ensure that "C:\ImageMagick-7.0.8-Q16" is on your system path.

You are writing to the output directory "Karatedo". If that directory does not exist, the command will fail.
snibgo's IM pages: im.snibgo.com
kimono
Posts: 11
Joined: 2019-04-01T01:40:36-07:00
Authentication code: 1152

Re: Batch magnify from a folder to an another one

Post by kimono »

@snibgo: I think I had got a problem of read only with some files in win10. I run a window command as administrator and I've got the following message:

Code: Select all

Access Denied.
So the correct command could be:

Code: Select all

C:\[Inputfolder]>magick.exe mogrify -path [outputfolder] -magnify *.png
?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Batch magnify from a folder to an another one

Post by fmw42 »

The output directory must be created ahead of time. Mogrify will not create one.

create a new directory Karatedo
change directory to your directory containing the images. Do not work in the ImageMagick directory as snibgo said.

Code: Select all

magick.exe mogrify -path path_to_existing/Karatedo -magnify *.png
Post Reply