Image resizing 10x slower on Linux than Mac

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
coffeebite
Posts: 2
Joined: 2018-02-28T21:43:52-07:00
Authentication code: 1152

Image resizing 10x slower on Linux than Mac

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image resizing 10x slower on Linux than Mac

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Image resizing 10x slower on Linux than Mac

Post by magick »

Is OpenCL enabled? If so, its utilizing the GPU to resize.
coffeebite
Posts: 2
Joined: 2018-02-28T21:43:52-07:00
Authentication code: 1152

Re: Image resizing 10x slower on Linux than Mac

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image resizing 10x slower on Linux than Mac

Post by fmw42 »

6.9.x.x? Fill in the x.x
muccigrosso
Posts: 64
Joined: 2017-10-03T10:39:52-07:00
Authentication code: 1151

Re: Image resizing 10x slower on Linux than Mac

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image resizing 10x slower on Linux than Mac

Post 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.
snibgo's IM pages: im.snibgo.com
muccigrosso
Posts: 64
Joined: 2017-10-03T10:39:52-07:00
Authentication code: 1151

Re: Image resizing 10x slower on Linux than Mac

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image resizing 10x slower on Linux than Mac

Post 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.
snibgo's IM pages: im.snibgo.com
muccigrosso
Posts: 64
Joined: 2017-10-03T10:39:52-07:00
Authentication code: 1151

Re: Image resizing 10x slower on Linux than Mac

Post 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?)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image resizing 10x slower on Linux than Mac

Post by fmw42 »

Best documentation right now about the differences is http://imagemagick.org/script/porting.php#cli
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Image resizing 10x slower on Linux than Mac

Post 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
muccigrosso
Posts: 64
Joined: 2017-10-03T10:39:52-07:00
Authentication code: 1151

Re: Image resizing 10x slower on Linux than Mac

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