Large GIF with Magick++

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
imironchik
Posts: 3
Joined: 2018-11-02T07:40:19-07:00
Authentication code: 1152

Large GIF with Magick++

Post by imironchik » 2018-11-02T07:47:39-07:00

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.

snibgo
Posts: 11474
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Large GIF with Magick++

Post by snibgo » 2018-11-02T07:54:46-07:00

You can edit policy.xml. Is that what you mean?
snibgo's IM pages: im.snibgo.com

imironchik
Posts: 3
Joined: 2018-11-02T07:40:19-07:00
Authentication code: 1152

Re: Large GIF with Magick++

Post by imironchik » 2018-11-02T08:37:40-07:00

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?

snibgo
Posts: 11474
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Large GIF with Magick++

Post by snibgo » 2018-11-02T09:12:56-07:00

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.
snibgo's IM pages: im.snibgo.com

imironchik
Posts: 3
Joined: 2018-11-02T07:40:19-07:00
Authentication code: 1152

Re: Large GIF with Magick++

Post by imironchik » 2018-11-02T09:25:37-07:00

Got it, thank you, I changed disk limit in policy.xml to 10 GiB and and now GIF opens.

Post Reply