Page 1 of 2

ImageMagick7 runs much slower than version6

Posted: 2019-10-07T14:15:36-07:00
by niyanwen
Hi,

according to the issue I mentioned in this post https://www.imagemagick.org/discourse-s ... 75#p169375
I try IM7 and looks like the issue got fixed, but the same command I used, but it is much slower
anyone knows why and how to fix it?

command I used:
convert img.png -resize 4500x5400! img_scale6.png
convert shirt.png -trim +repage -bordercolor none -border 5 shirt3.png

IM7 version: libMagickCore-7.Q16HDRI.so.6

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T14:18:14-07:00
by niyanwen
Hi,

according to the issue I mentioned in this post https://www.imagemagick.org/discourse-s ... 75#p169375
I try IM7 and looks like the issue got fixed, but the same command I used, but it is much slower
anyone knows why and how to fix it?

command I used:
convert img.png -resize 4500x5400! img_scale6.png
convert shirt.png -trim +repage -bordercolor none -border 5 shirt3.png

IM7 version: libMagickCore-7.Q16HDRI.so.6

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T14:48:02-07:00
by fmw42
It is slower in part because IM 7 is built with HDRI by default. You can recompile without HDRI and you can recompile with Q8 in place of the default Q16.

With IM 7, use magick in place of convert.

The issue may have been fixed simply by using a more current version of libpng or if the IM 7 has lcms.

Check your version of libpng and also if lcms in included.

Code: Select all

convert -list format
for the libpng

Code: Select all

convert -version
to see your delegate list

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T15:40:51-07:00
by niyanwen
I don't know why I always see this error when I am using image magick 7
./convert: error while loading shared libraries: libMagickCore-7.Q16HDRI.so.6: cannot open shared object file: No such file or directory

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T16:06:21-07:00
by niyanwen
okay make it work
when I run convert -list format

PNG* rw- Portable Network Graphics (libpng 1.6.28)
See http://www.libpng.org/ for details about the PNG format.
PNG00* rw- PNG inheriting bit-depth, color-type from original, if possible
PNG24* rw- opaque or binary transparent 24-bit RGB (zlib 1.2.11)
PNG32* rw- opaque or transparent 32-bit RGBA
PNG48* rw- opaque or binary transparent 48-bit RGB
PNG64* rw- opaque or transparent 64-bit RGBA
PNG8* rw- 8-bit indexed with optional binary transparency


when I run convert version, I got
Version: ImageMagick 7.0.8-37 Q16 x86_64 2019-09-13 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI 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-07T16:58:27-07:00
by niyanwen
is is because of missing lcms so cause this issue?

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T17:32:00-07:00
by fmw42
Not if you are not using profiles. But it could be the libpng version. When using IM 7, use magick not convert; otherwise, you may be getting IM 6 behavior. Try

Code: Select all

magick -version

Code: Select all

magick -list format

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T18:07:50-07:00
by niyanwen
Version: ImageMagick 7.0.8-37 Q16 x86_64 2019-09-13 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP
Delegates (built-in): bzlib fontconfig freetype jng jp2 jpeg lcms png raw tiff webp xml zlib

PNG* rw- Portable Network Graphics (libpng 1.6.28)
See http://www.libpng.org/ for details about the PNG format.
PNG00* rw- PNG inheriting bit-depth, color-type from original, if possible
PNG24* rw- opaque or binary transparent 24-bit RGB (zlib 1.2.11)
PNG32* rw- opaque or transparent 32-bit RGBA
PNG48* rw- opaque or binary transparent 48-bit RGB
PNG64* rw- opaque or transparent 64-bit RGBA
PNG8* rw- 8-bit indexed with optional binary transparency

looks like it is same

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T18:49:29-07:00
by fmw42
As I mentioned before, IM 7 has HDRI enabled by default. IM 6 does not. What are the resourced for both?

Code: Select all

convert -list resource

Code: Select all

magick -list resource
Or check your policy.xml file.

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T20:22:16-07:00
by niyanwen
the output of those commands are same, is there a way to disable the HDRI in command? now I switch to IM7 and it is 5x times slower than IM6

Resource limits:
Width: 107.374MP
Height: 107.374MP
Area: 63.2173GP
List length: unlimited
Memory: 29.4378GiB
Map: 58.8757GiB
Disk: unlimited
File: 49151
Thread: 16
Throttle: 0
Time: unlimited

Resource limits:
Width: 107.374MP
Height: 107.374MP
Area: 63.2173GP
List length: unlimited
Memory: 29.4378GiB
Map: 58.8757GiB
Disk: unlimited
File: 49151
Thread: 16
Throttle: 0
Time: unlimited

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T20:48:03-07:00
by fmw42
Are you sure you are listing information for two different ImageMagick versions? Did you put the full path to convert and to magick for IM 6 and for IM 7 when running the commands.


As far as I know, you have to recompile with --disable HDRI in your .configure script.

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T20:50:28-07:00
by niyanwen
I am listing it only for IM7, I only have IM7 in this host

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T20:58:41-07:00
by fmw42
I asked you to compare the resources between IM 6 and IM 7 to see if you need to match the IM 6 resource limits with IM 7. But it looks to me like you have enough resources on your IM 7. The only other thing to consider is if you disable OpenMP. On some platforms and commands it might run slower. That would require you to recompile. But you can limit the threads to 1 in your command line to see if that would help.

magick -limit thread 1 input ... output

As I mentioned before, you will improve speed if you do not write your command as two commands, but combine as one. That way you do not waste time writing the intermediate file to disk.

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T22:16:02-07:00
by niyanwen
is there a way I can combine these two commands into one?
so this is first command:
convert a.png -resize 4500x5400! b.png
this second command:
convert b.png -format %@ -write info: -trim +repage -bordercolor none -border 5 c.png

Re: ImageMagick7 runs much slower than version6

Posted: 2019-10-07T22:27:16-07:00
by niyanwen
looks like I make it combine by this:
convert src.png -resize 4000x5000! -format %@ -write info: -trim +repage -bordercolor none -border 5 dest.png