Page 1 of 1

Image resizing 10x slower on Linux than Mac

Posted: 2018-02-28T21:56:03-07:00
by coffeebite
Hey folks,

I am trying to resize an animated gif as follows<br/>

Code: Select all

convert photo.gif -coalesce -resize 16x16 output.gif
It takes about 1.5s on my Mac but 20s on my Linux server (Debian Stretch). Both devices don't have much running other than my conversion command. The Mac has 2 cores and 16gb ram. The Linux box has 8 cores and 16gb ram.

It only happens with this image: (https://padlet-uploads.storage.googleap ... /photo.gif). Other image resizes are comparable in time. I have tried both with and without openmp (some old forum posts seemed to suggest openmp could be a problem).

Running v7.0.7 on both machines.

Any idea what could be happening?

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-02-28T22:34:40-07:00
by fmw42
Are you sure that your Linux box is using all 8 cores? Is it a shared server? If on IM 7, your command should be using magick and not convert

Code: Select all

magick photo.gif -coalesce -resize 16x16 output.gif
What exact version of IM 7 are you using 7.0.7.x?

What do you get from

Code: Select all

magick -version
It runs in about 1 sec on my INTEL Mac Mini running 2 cores.

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-01T05:44:52-07:00
by magick
Is OpenCL enabled? If so, its utilizing the GPU to resize.

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-01T15:47:14-07:00
by coffeebite
Thanks. It doesn't look like OpenCL is installed on either the Mac or the Linux versions.

Upon further investigation, it takes 1.5s to do this transform on Linux with ImageMagick 6.8.9-10 but 20s with ImageMagick 6.9 and above.

Any idea what could have changed in 6.9 to cause this 12x slowdown?

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-01T16:29:03-07:00
by fmw42
6.9.x.x? Fill in the x.x

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-03T17:22:04-07:00
by muccigrosso
fmw42 wrote: 2018-02-28T22:34:40-07:00 If on IM 7, your command should be using magick and not convert
I've wondered about this before: in what contexts should one use magick instead of convert or one of the other commands like identify (instead of info)?

EDIT: Looking at my system, I see that all the other commands are just symlinked to magick, so I assume that any time you use one of them, you're just saving on the typing of "magick" at the start. And it also looks like identify is faster than outputting to info:. But, as in the case here, why magick and not convert, and are there other similar contexts?

TIA.

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-03T19:52:22-07:00
by snibgo
My advice is:

"convert" is a v6 command. "magick" is a v7 command. I use both versions, and I haven't set symbolic links in either direction because I want to be sure which version I am using.

For new scripts that are written for v7, there is no need to use "convert". If we use "convert" for v7, a person or a computer might think this is for v6.

For new scripts for v6, I use "convert". For new scripts for v7, I use "magick" (not "magick convert"). Similarly, for v7 I use "magick compare", "magick identify" etc.

For testing purposes, I also have a script that converts v6 scripts into v7 scripts, and runs both versions, and reports if the outputs are different.

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-03T20:14:07-07:00
by muccigrosso
snibgo wrote: 2018-03-03T19:52:22-07:00 "convert" is a v6 command. "magick" is a v7 command. I use both versions, and I haven't set symbolic links in either direction because I want to be sure which version I am using.
Ah, that makes some sense. FWIW, I'm using a homebrew-installed version on my Mac, which reports:

Code: Select all

Version: ImageMagick 7.0.7-24 Q16 x86_64 2018-03-02 http://www.imagemagick.org
All of what I guess are the version 6 commands are symlinked to "magick", so I hadn't noticed that 7 differs from all the great how-to Usage files on-line:

Code: Select all

lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 animate -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 compare -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 composite -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 conjure -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 convert -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 display -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 identify -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 import -> magick
-r-xr-xr-x   1 john_muccigrosso  admin  26712 Mar  2 19:04 magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 magick-script -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 mogrify -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 montage -> magick
lrwxr-xr-x   1 john_muccigrosso  admin      6 Mar  2 19:04 stream -> magick

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-03T20:40:44-07:00
by snibgo
I'm surprised those symlinks work. For example, "magick identify rose:" is a valid command but "magick rose:" isn't, so if "identify" is a symlink to "magick", is "identify rose:" valid somehow?

The usage pages, and my own pages, were written for v6. Using symlinks means the v6 documentation can be directly used for v7, except that v7 is different to v6, and isn't a drop-in replacement.

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-03T22:25:23-07:00
by muccigrosso
snibgo wrote: 2018-03-03T20:40:44-07:00 I'm surprised those symlinks work. For example, "magick identify rose:" is a valid command but "magick rose:" isn't, so if "identify" is a symlink to "magick", is "identify rose:" valid somehow?
Yep, so maybe there are other things going on. I can tell you that they work though.

(Is there work being done to update those Usage pages?)

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-04T13:27:25-07:00
by fmw42
Best documentation right now about the differences is http://imagemagick.org/script/porting.php#cli

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-04T15:18:55-07:00
by magick
We're using ImageMagick 7.0.7-25 and get sub-second processing time under Fedora 27:

Code: Select all

$ time magick photo.gif -coalesce -resize 16x16 +dither output.gif
0.415u 0.046s 0:00.46 97.8%     0+0k 360+944io 2pf+0w

Re: Image resizing 10x slower on Linux than Mac

Posted: 2018-03-05T12:34:35-07:00
by muccigrosso
fmw42 wrote: 2018-03-04T13:27:25-07:00 Best documentation right now about the differences is http://imagemagick.org/script/porting.php#cli
Thanks. That's helpful.

BTW, @snibgo, note that it says this about the "old" utilities:
To reduce the footprint of the command-line utilities, these utilities are symbolic links to the magick utility.