[Solved] conversion sometimes VERY slow

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
DynV
Posts: 10
Joined: 2011-05-23T07:16:09-07:00
Authentication code: 8675308
Location: Montreal, Canada

[Solved] conversion sometimes VERY slow

Post 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
Last edited by DynV on 2011-05-24T05:16:29-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: conversion sometimes VERY slow

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
DynV
Posts: 10
Joined: 2011-05-23T07:16:09-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: conversion sometimes VERY slow

Post 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!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: conversion sometimes VERY slow

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
DynV
Posts: 10
Joined: 2011-05-23T07:16:09-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: conversion sometimes VERY slow

Post by DynV »

So should I use the following?
mogrify *.bmp -normalize --format png
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: conversion sometimes VERY slow

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
DynV
Posts: 10
Joined: 2011-05-23T07:16:09-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: conversion sometimes VERY slow

Post 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. :)
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: conversion sometimes VERY slow

Post by glennrp »

Try -format instead of --format
User avatar
DynV
Posts: 10
Joined: 2011-05-23T07:16:09-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: [Solved] conversion sometimes VERY slow

Post 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 ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [Solved] conversion sometimes VERY slow

Post by anthony »

Sorry.. about the confusion with -- over the -
Some commands like using a '--' for 'word-like' arguments
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [Solved] conversion sometimes VERY slow

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
DynV
Posts: 10
Joined: 2011-05-23T07:16:09-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: [Solved] conversion sometimes VERY slow

Post 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.
Post Reply