ImageMagick7 runs much slower than version6

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?".
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

ImageMagick7 runs much slower than version6

Post 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
Last edited by niyanwen on 2019-10-07T14:18:28-07:00, edited 1 time in total.
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

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

Re: ImageMagick7 runs much slower than version6

Post 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
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

Post 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
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

Post 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
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

Post by niyanwen »

is is because of missing lcms so cause this issue?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick7 runs much slower than version6

Post 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
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

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

Re: ImageMagick7 runs much slower than version6

Post 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.
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

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

Re: ImageMagick7 runs much slower than version6

Post 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.
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

Post by niyanwen »

I am listing it only for IM7, I only have IM7 in this host
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick7 runs much slower than version6

Post 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.
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

Post 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
niyanwen
Posts: 71
Joined: 2019-05-23T16:19:12-07:00
Authentication code: 1152

Re: ImageMagick7 runs much slower than version6

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