Page 2 of 2

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T22:31:28-07:00
by fmw42
Correct. That is what I wrote earlier in this topic.

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T23:04:50-07:00
by niyanwen
the one you talk about limit thread is this below?
convert -limit thread 1 src.png -resize 4000x5000! -format %@ -write info: -trim +repage -bordercolor none -border 5 dest.png

I try this but got errors

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-08T09:31:14-07:00
by fmw42
It works fine for me.

Code: Select all

convert -limit thread 1 b07s8dt2vc-large-front_image.png -resize 4500x5400! -format %@ -write info: -trim +repage -bordercolor none -border 5 result.png
3739x5194+452+57

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-08T16:11:13-07:00
by niyanwen
Hi,
does that mean HDRI has been disabled?
looks like it is still slow. do I need also disable OpenMP? if it is, do you know how to do it?

[niyanwen@mftp-ygw-i-d-2a-43520b1f]/apollo/env/MerchFTProductionAssetManagerService/bin% ./convert -version
Version: ImageMagick 7.0.8-37 Q16 x86_64 2019-10-08 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib fontconfig freetype jng jp2 jpeg lcms png raw tiff webp xml zlib

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-08T16:44:23-07:00
by fmw42
-limit thread 1 just disable your 16 processors and forces Imagemagick to use just 1. It has nothing to do with HDRI. To disable HDRI or OpenMP, you have to recompile ImageMagick. I doubt disabling OpenMP will make a difference since -limit thread 1 did not seem to help.

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-08T16:55:37-07:00
by niyanwen
oh I haven't try limit 1 yet, now I just tried disable HDR I found in some posts says it will help, I saw another suggestion is try add -quality 21?
https://www.imagemagick.org/discourse-s ... hp?t=27672

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-08T17:01:31-07:00
by niyanwen
looks like limit thread helps and speed improve a lot!

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-08T17:12:07-07:00
by niyanwen
fmw42 wrote:
2019-10-08T16:44:23-07:00
-limit thread 1 just disable your 16 processors and forces Imagemagick to use just 1. It has nothing to do with HDRI. To disable HDRI or OpenMP, you have to recompile ImageMagick. I doubt disabling OpenMP will make a difference since -limit thread 1 did not seem to help.
just one concern is what do you mean disable 16 processors and force to just use 1?
for if this host has another image magick command running, is it acceptable?

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-08T17:37:55-07:00
by fmw42
It only disables the other processors for the command for which -limit is set, not for the server. But that did not help, so no point in doing -limit. However, if your hosting provided disables OpenMP or HDRI, that would affect the whole server and all users. So that is not likely going to happen if you are on a shared server.

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-09T06:14:10-07:00
by snibgo
Multi-threading can be disabled per command, but HDRI is a build-level switch.

I use at least two versions of IM: HDRI when I need precision, and non-HDRI when I need speed. This may not be feasible on a shared server.

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-09T08:57:55-07:00
by niyanwen
limit thread help, so now I am doing 1. limit 2. disable HDR 3. add quality to improve the speed, thank you guys!

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-09T09:20:04-07:00
by niyanwen
IM6 is limit thread 1 by default?

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-09T10:42:22-07:00
by snibgo
niyanwen wrote:IM6 is limit thread 1 by default?
No. "convert -list resource" shows the limit:

Code: Select all

Resource limits:
  Width: 214.7MP
  Height: 214.7MP
  List length: 18.446744EP
  Area: 6.4068GP
  Memory: 2.9834GiB
  Map: 5.9668GiB
  Disk: unlimited
  File: 1536
  Thread: 8  <<========
  Throttle: 0
  Time: unlimited
On my computer, the limit is 8.

Re: ImageMagick7 runs much slower than version6

Posted: 2020-01-09T08:06:25-07:00
by ethaniel
I rebuilt ImageMagick 7 without OPENMP, HDRI and set to Q8. It is still much slower than imagemagick 6 (100-110ms per image vs 80ms per image).

Code: Select all

./configure --enable-shared --enable-symbol-prefix --with-quantum-depth=8 --enable-hdri=no CFLAGS="-I/opt/libjpeg-turbo/include" LDFLAGS="-L/opt/libjpeg-turbo/lib64" --disable-openmp

Code: Select all

Version: ImageMagick 7.0.9-14 Q8 x86_64 2020-01-09 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC
Delegates (built-in): bzlib fontconfig freetype jng jpeg lcms lzma png tiff webp xml zlib

Code: Select all

convert -list resource
Resource limits:
  Width: 429.497MP
  Height: 429.497MP
  Area: 10.7374GP
  List length: unlimited
  Memory: 5GiB
  Map: 10GiB
  Disk: unlimited
  File: 375000
  Thread: 1
  Throttle: 0
  Time: unlimited

Re: ImageMagick7 runs much slower than version6

Posted: 2020-01-09T08:44:01-07:00
by magick
See https://imagemagick.org/script/porting.php. You'll find that IMv7 handles multi-spectral images. That means that channels are handled individually as an array of channels. Looping through the channels has a performance hit vs. IMv6 which handles RGBA as a single packet. There are tradeoffs for this enhancement. For example, for IMv7 you can process a 1-channel gray image whereas with IMv6, a gray image consumes 4 channels even for a 1-channel gray image. Here IMv7 requires 25% of the memory that IMv6 does for gray images. So in some cases, IMv7 will be much faster than IMv6 and in others, IMv6 performance will outpace that of IMv7.