Page 1 of 1

Why IM is several times slower than IrfanView?

Posted: 2011-08-01T15:33:34-07:00
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. :)

Re: Why IM is several times slower than IrfanView?

Posted: 2011-08-01T17:00:13-07:00
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.

Re: Why IM is several times slower than IrfanView?

Posted: 2011-08-01T18:42:31-07:00
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

Re: Why IM is several times slower than IrfanView?

Posted: 2011-08-01T20:10:47-07:00
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

Re: Why IM is several times slower than IrfanView?

Posted: 2011-08-01T23:12:08-07:00
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

Re: Why IM is several times slower than IrfanView?

Posted: 2011-08-02T08:21:18-07:00
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.