Why IM is several times slower than IrfanView?

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
projapati
Posts: 6
Joined: 2011-07-31T00:47:27-07:00
Authentication code: 8675308

Why IM is several times slower than IrfanView?

Post by projapati »

I am trying to batch process 30 images (2MB avg size) in a folder.
The IrfanView seems converting (resample and resize) very very quickly.
But ImageMagick takes 10-20 times longer to process the 30 files.

Is this speed issue typical for IM?
How can I cam IM faster when I run this type of command for conversion:

>convert.exe *.jpg -sampling-factor 4:4:4 -quality 95 -resize 640x640 -unsharp 0x1 -path "c:\Temp\Destination\"

I am investigating IM since IrfanView can't create center square images. :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why IM is several times slower than IrfanView?

Post by fmw42 »

your syntax is wrong. see your other topic. IM is a general purpose image processing system and is not optimized like perhaps irfanview to do certain limited things especially fast.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Why IM is several times slower than IrfanView?

Post by anthony »

Also using convert means that it will read ALL the images into memory first! mogrify may actually be better as it will only read and process one image file at a time.

However fred is quite correct in IM being far more general with many many many more processing options giving you more exact control of exactly how you want to process images. This however means it is less optimized for specific tasks.


WARNING: -path is only used by mogrify it is NOT a convert option whcih requires you to provide separate input and output options. Also mogrify processing image files one at a time, convert reads and processes the images AS GIVEN, which in your case probably means all images in memory at the same time (big memory footprint).

See IM Examples, Basics, Mogrify, convert method, for details of pros and cons.
http://www.imagemagick.org/Usage/basics ... fy_convert
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Why IM is several times slower than IrfanView?

Post by whugemann »

I am using both IrfanView and ImageMagick daily, and yes, IM is significantly slower than IrfanView when it comes to the actual work. Performing standard tasks with IM is however overall faster, because they can be fully automized. See the link below for a bunch of examples. When converting several files, I would typically loop through them by a batch command, i.e.:

Code: Select all

FOR EACH %%a in (*.jpg) DO convert.exe %%a -sampling-factor 4:4:4 -quality 95%% -resize 640x640 -unsharp 0x1 c:\Temp\Destination\%%~na.jpg
Wolfgang Hugemann
projapati
Posts: 6
Joined: 2011-07-31T00:47:27-07:00
Authentication code: 8675308

Re: Why IM is several times slower than IrfanView?

Post by projapati »

whugemann wrote:I am using both IrfanView and ImageMagick daily, and yes, IM is significantly slower than IrfanView when it comes to the actual work. Performing standard tasks with IM is however overall faster, because they can be fully automized. See the link below for a bunch of examples. When converting several files, I would typically loop through them by a batch command, i.e.:

Code: Select all

FOR EACH %%a in (*.jpg) DO convert.exe %%a -sampling-factor 4:4:4 -quality 95%% -resize 640x640 -unsharp 0x1 c:\Temp\Destination\%%~na.jpg
Thanks a lot. I am also planning loop.
How to call or utilize your batch script that has the loop?
I will end up writing a C# console app that would run these commands from the C# app. Is this the right way to do it?

Please help me with your expertise.

Thanks
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Why IM is several times slower than IrfanView?

Post by whugemann »

I will end up writing a C# console app that would run these commands from the C# app. Is this the right way to do it?
That sounds needlessly complicated to me. Why don't you run just a DOS batch file within a DOS box?
Again, I would recommend that you study the examples on the page linked below in order to see what can be done with DOS batch files or Visual Basic Script.

Then you might decide to switch to C# or whatever. But usually, you would then call IM via MagickNET. Find an example at http://sourceforge.net/projects/imagemagickapp I haven't tried this so far. Everything I ever needed was possible by batch files or VisualBasic Script.
Wolfgang Hugemann
Post Reply