Animated GIF killing magick

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
mgo
Posts: 11
Joined: 2019-03-17T02:55:46-07:00
Authentication code: 1152

Animated GIF killing magick

Post by mgo »

Hi!

Out customer uploaded a 1mb GIF file, which on command "-coalesce" causes the RAM usage to peak at 9GB and takes around 40seconds to process.
It looks like a magick bug (other tools handle it well).
Below is link to the aforementioned file:
http://klient.artigo.pl/imagemagick/m3-zinsen-gif.gif
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Animated GIF killing magick

Post by magick »

On our host, the conversion completed in 3 seconds. We're using ImageMagick 7.0.8-64. Your system may be thrashing. Try this command instead:

Code: Select all

magick convert -define registry:temporary-path=./ -limit area 0 m3-zinsen-gif.gif -coalesce coalesce.gif
mgo
Posts: 11
Joined: 2019-03-17T02:55:46-07:00
Authentication code: 1152

Re: Animated GIF killing magick

Post by mgo »

Dear Magick,

I will try upgrading. I was testing on 6.9.10-62 Q16 x86_64 & 7.0.5-4 Q16 x64
I tried the command and for me it reduces the RAM usage to 100-200mb level, which is very good, but it still takes siginificant amount of CPU (and takes a long time).
Do you think that setting the temp directory results in reduced RAM usage?
I will get back to you once I updated. Thanks for helping out!
mgo
Posts: 11
Joined: 2019-03-17T02:55:46-07:00
Authentication code: 1152

Re: Animated GIF killing magick

Post by mgo »

Updating did not make any effect. System is equipped with SSD. I wonder how can you achieve 3 seconds when it takes 30-40seconds for me. Other GIFs take 1s to process, but not this one. I'm trying both Linux and Windows versions.
mgo
Posts: 11
Joined: 2019-03-17T02:55:46-07:00
Authentication code: 1152

Re: Animated GIF killing magick

Post by mgo »

Can it be ImageMagick configuration?
I'm pasting the config:

Code: Select all

Path: /usr/local/pd-admin2/lib/ImageMagick-6.9.10//config-Q16/configure.xml

Name           Value
-------------------------------------------------------------------------------
CC             gcc -std=gnu99 -std=gnu99
CFLAGS         -I/usr/local/pd-admin2/include/libxml2 -I/usr/local/pd-admin2/inc                                                                                                                                                             lude   -I/usr/local/pd-admin2/include   -I/usr/local/pd-admin2/include/libpng16                                                                                                                                                                -I/usr/local/pd-admin2/include   -I/usr/local/pd-admin2/include/freetype2 -I/u                                                                                                                                                             sr/local/pd-admin2/include   -I/usr/local/pd-admin2/include     -g -O2 -Wall -mt                                                                                                                                                             une=core2 -fexceptions -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH     /usr/local/pd-admin2/lib/ImageMagick-6.9.10/modules-Q16/coders
CONFIGURE      ./configure  '--prefix=/usr/local/pd-admin2' '--without-x' '--wit                                                                                                                                                             hout-threads' '--with-perl' 'CPPFLAGS=-I/usr/local/pd-admin2/include' 'LDFLAGS=-                                                                                                                                                             Wl,-rpath=/usr/local/pd-admin2/syslib4:/usr/local/pd-admin2/syslib:/usr/local/pd                                                                                                                                                             -admin2/lib -L/usr/local/pd-admin2/lib -lrt' 'PKG_CONFIG_PATH=/usr/local/pd-admi                                                                                                                                                             n2/lib/pkgconfig'
CONFIGURE_PATH /usr/local/pd-admin2/etc/ImageMagick-6/
COPYRIGHT      Copyright (C) 1999-2019 ImageMagick Studio LLC
CPPFLAGS       -I/usr/local/pd-admin2/include/ImageMagick-6
CXX            g++
CXXFLAGS       -g -O2 -mtune=core2
DEFS           -DHAVE_CONFIG_H
DELEGATES      bzlib mpeg freetype jng jpeg lcms png ps tiff webp xml zlib
DISTCHECK_CONFIG_FLAGS 'CPPFLAGS=-I/usr/local/pd-admin2/include' 'LDFLAGS=-Wl,-r                                                                                                                                                             path=/usr/local/pd-admin2/syslib4:/usr/local/pd-admin2/syslib:/usr/local/pd-admi                                                                                                                                                             n2/lib -L/usr/local/pd-admin2/lib -lrt'  --disable-deprecated  --with-quantum-de                                                                                                                                                             pth=16  --with-jemalloc=no  --with-umem=no  --with-autotrace=no  --with-gslib=no                                                                                                                                                               --with-fontpath=  --with-rsvg=no
DOCUMENTATION_PATH /usr/local/pd-admin2/share/doc/ImageMagick-6
EXEC-PREFIX    /usr/local/pd-admin2
EXECUTABLE_PATH /usr/local/pd-admin2/bin
FEATURES       DPC Cipher
FILTER_PATH    /usr/local/pd-admin2/lib/ImageMagick-6.9.10/modules-Q16/filters
GIT_REVISION   14778
HOST           x86_64-pc-linux-gnu
INCLUDE_PATH   /usr/local/pd-admin2/include/ImageMagick-6
LDFLAGS        -L/usr/local/pd-admin2/lib -Wl,-rpath=/usr/local/pd-admin2/syslib                                                                                                                                                             4:/usr/local/pd-admin2/syslib:/usr/local/pd-admin2/lib -L/usr/local/pd-admin2/li                                                                                                                                                             b -lrt
LIB_VERSION    0x69A
LIB_VERSION_NUMBER 6,9,10,62
LIBRARY_PATH   /usr/local/pd-admin2/lib/ImageMagick-6.9.10
LIBS             -L/usr/local/pd-admin2/lib -llcms2   -ltiff -L/usr/local/pd-adm                                                                                                                                                             in2/lib -lfreetype    -ljpeg   -L/usr/local/pd-admin2/lib -lpng16 -lz -lm                                                                                                                                                                        -L/usr/local/pd-admin2/lib -lwebp          -lbz2      -L/usr/local/pd-admin2                                                                                                                                                             /lib -lxml2    -L/usr/local/pd-admin2/lib -lz       -lm     -lgomp
NAME           ImageMagick
PCFLAGS        -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX         /usr/local/pd-admin2
QuantumDepth   16
RELEASE_DATE   2019-08-28
SHARE_PATH     /usr/local/pd-admin2/share/ImageMagick-6
SHAREARCH_PATH /usr/local/pd-admin2/lib/ImageMagick-6.9.10/config-Q16
TARGET_CPU     x86_64
TARGET_OS      linux-gnu
TARGET_VENDOR  pc
VERSION        6.9.10
WEBSITE        https://imagemagick.org

Path: [built-in]

Name           Value
-------------------------------------------------------------------------------
DELEGATES      bzlib freetype jng jpeg lcms png tiff webp xml zlib
FEATURES       Cipher
NAME           ImageMagick
QuantumDepth   Q16

User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Animated GIF killing magick

Post by magick »

One difference is OpenMP support. We have a 6 core processor with 6 hyperthreads. With the OpenMP feature enabled, 12 threads are run in parallel when coalescing. Your slow-down may come from thrashing and also running in a single thread.
mgo
Posts: 11
Joined: 2019-03-17T02:55:46-07:00
Authentication code: 1152

Re: Animated GIF killing magick

Post by mgo »

Yes it's possible. Thank you!
mgo
Posts: 11
Joined: 2019-03-17T02:55:46-07:00
Authentication code: 1152

Re: Animated GIF killing magick

Post by mgo »

Sadly, enabling OpenMP did not make a difference. Problem must be elsewhere.
Post Reply