Page 1 of 1

[Solved] conversion sometimes VERY slow

Posted: 2011-05-23T08:28:05-07:00
by DynV
The 1st time I used ImageMagick (not testing it), it took about 10 hours on this dual 2 GHz with 2Gb (of RAM) to convert about 1000 BMP of about 4Mb (each) into PNG with the command
convert *.bmp -normalize -set filename:fname %t +adjoin %[filename:fname].png
The 2nd time I was amazed as it took about the same time that I'd be saving a copy with GIMP (when the image is loaded), which is about 5 seconds each ; I could just watch the progress with Windows Explorer as the files quickly appeared. so I figured there was an issue the first time, perhaps the HDD was busy with another program, perhaps a service that isn't monitored in the Recource Monitor (from Windows Task Manager tab Performance). So I figured if it slowed down again I'd wait until I'd freshly rebooted so that an issue would less likely have started.

Well the 3rd time was incredibly slow, just like the first time, so I stopped the process and added a mental note for reboot. Later I had to reboot for something else and the note popped up (in my mind), so I one of the first thing I did with this fresh start was to run the command (in the first paragraph) but it was still suuuper slow.

Any idea what might cause this performance issue? The version used (in all those cases) was 6.6.9-5.
Thank you kindly

Re: conversion sometimes VERY slow

Posted: 2011-05-23T21:48:56-07:00
by anthony
Yes...

You are reading in ALL the images into memory first, then processing.
Basically you are running out of memory so IM is using slow disk!

use mogrify rather than convert as this only reads and processed one image filename at a time!
That is the major difference between the two commands.

Re: conversion sometimes VERY slow

Posted: 2011-05-23T22:57:54-07:00
by DynV
Thanks again or letting me know of Mogrify and a difference from Convert.

Before entering the command, just changing convert for , I checked mogrify options and all those I previously used (OP 1st paragraph) seemed supported but after running it I got the error
>"C:\Program Files\ImageMagick-6.6.9-Q16\mogrify" *.bmp -normalize -set filename:fname %t +adjoin %[filename:fname].png
Magick: unrecognized option `+adjoin' @ error/mogrify.c/MogrifyImageCommand/3868.
What I'm trying to do is to convert all BMPs to PNGs and in the process have dark images somewhat brightened and bright images somewhat darkened ; some of those are very dark and others are quite bright (dark is more of a problem than bright though).

Optionally, could you let me know of other differences between Mogrify and Convert ?

Thanks!

Re: conversion sometimes VERY slow

Posted: 2011-05-23T23:10:38-07:00
by anthony
The +adjoin is typically not needed for mogrify as it only processing one file at a time.

In any case PNG images can not save multiple images in a single file so the +adjoin is automatic.

It was however required in my actual example of using the convert technique, as I was saving to GIF, and I did not want all the images read in by convert saved into the first image filename!!! :-)

Note that unless you change file formats (using -format) or out directory (using -path) in mogrify, mogrify will overwrite the original image. This is why I have warnings about it.

Re: conversion sometimes VERY slow

Posted: 2011-05-23T23:34:43-07:00
by DynV
So should I use the following?
mogrify *.bmp -normalize --format png

Re: conversion sometimes VERY slow

Posted: 2011-05-23T23:41:54-07:00
by anthony
That will be fine, and will work as is. But it is more normally written...

Code: Select all

   mogrify --format png -normalize  *.bmp

Re: conversion sometimes VERY slow

Posted: 2011-05-24T00:53:13-07:00
by DynV
Well I used your version of the command and got the following error:
>"C:\Program Files\ImageMagick-6.6.9-Q16\mogrify" --format png -normalize *.bmp
Magick: unable to open image `--format': No such file or directory @ error/blob.c/OpenBlob/2587.
Magick: no decode delegate for this image format `--format' @ error/constitute.c/ReadImage/532.
Magick: unable to open image `png': No such file or directory @ error/blob.c/OpenBlob/2587.
Magick: no decode delegate for this image format `png' @ error/constitute.c/ReadImage/532.
I hoped to figure this out by myself but starting with the first error I couldn't do it. I did a search then went through some pages searching (using my browser) for image `--format' in vain. I won't be offended if you point out a better way to troubleshoot. :)

Re: conversion sometimes VERY slow

Posted: 2011-05-24T05:09:11-07:00
by glennrp
Try -format instead of --format

Re: [Solved] conversion sometimes VERY slow

Posted: 2011-05-24T05:18:53-07:00
by DynV
Aaah! Back to about 5 seconds per conversion. :D

I knew something I did was wrong as I've heard so much good things about ImageMagick. Thanks again for your help.

Just in case this was skipped (I'm not hoping for a reply but it would be nice): Optionally, could you let me know of other differences between Mogrify and Convert ?

Re: [Solved] conversion sometimes VERY slow

Posted: 2011-05-24T17:42:40-07:00
by anthony
Sorry.. about the confusion with -- over the -
Some commands like using a '--' for 'word-like' arguments

Re: [Solved] conversion sometimes VERY slow

Posted: 2011-05-24T17:51:15-07:00
by anthony
DynV wrote:Just in case this was skipped (I'm not hoping for a reply but it would be nice): Optionally, could you let me know of other differences between Mogrify and Convert ?
See IM Examples, Basics, Mogrify
http://www.imagemagick.org/Usage/basics/#mogrify

You may like to note the types of operators (EG: simple verses multi-image and stack/sequence)
http://www.imagemagick.org/Usage/basics ... _operators

Re: [Solved] conversion sometimes VERY slow

Posted: 2011-05-24T18:10:15-07:00
by DynV
anthony wrote:See IM Examples, Basics, Mogrify
http://www.imagemagick.org/Usage/basics/#mogrify
Awesome! :D
anthony wrote:You may like to note the types of operators (EG: simple verses multi-image and stack/sequence)
http://www.imagemagick.org/Usage/basics ... _operators
I suppose you mentioned that in case I skipped the following from basics.
Due to the multi-image processing capability the "mogrify" command can not use either Multi-Image Sequence Operators or Image Stack/List Operators. That means you can not use image processing operators like "-fx", "+swap", "-composite", "-append", "-flatten", and "-layers" in a "mogrify" command.

As some setting options are needed to be set before the first image is read in (for example (for example "-size", "-label" and "-density"), these options are processed and set before the first image is read in. After this each image is read in and the operators applied to them in command line order before the image is saved and the next image read in.

It is important to keep this in mind as if you change one of these settings later in the sequence you can make IM forget a previous setting.