Page 1 of 1

Large GIF with Magick++

Posted: 2018-11-02T07:47:39-07:00
by imironchik
Hello,

Is it possible to disable core limits of ImageMagick so it will open 500 frames GIF of ~1900x1000 size, so it will use all available memory and fail only if memory is exhausted? Right now it correctly reads somewhere first 35 coalesced frames and no one operation can be done as pixel cache is exhausted. I'd prefer to allow Magick++ to use all available memory and throw exception if memory is out, so I can tell user that exactly this GIF is so big and can't be opened.

Thank you.

Re: Large GIF with Magick++

Posted: 2018-11-02T07:54:46-07:00
by snibgo
You can edit policy.xml. Is that what you mean?

Re: Large GIF with Magick++

Posted: 2018-11-02T08:37:40-07:00
by imironchik
You want to say that:

Code: Select all

Magick::InitializeMagick( nullptr );
std::vector< Magick::Image > frames;
Magick::readImages( &frames, fileName.toStdString() );
Magick::coalesceImages( &d->m_frames, frames.begin(), frames.end() );
uses policy.xml?

Can I somehow don't use any configuration files, just C++ code?

Re: Large GIF with Magick++

Posted: 2018-11-02T09:12:56-07:00
by snibgo
ImageMagick uses its configuration files. You can't turn that off. These set system-wide limits on memory usage etc. Limits can also work at the user level, or session level, or command level, but these can only be stricter. They cannot relax limits.

By default, IM will use all available memory for pixel caches. If that's not enough, it uses disk. policy.xml can set limits on memory and disk. I guess yours does. Editing that file will relax those limits.

Re: Large GIF with Magick++

Posted: 2018-11-02T09:25:37-07:00
by imironchik
Got it, thank you, I changed disk limit in policy.xml to 10 GiB and and now GIF opens.