Magick: memory allocation failed `imagePath' @ error/bmp.c/ReadBMPImage/941

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
umair.xdoz
Posts: 1
Joined: 2018-01-10T18:43:09-07:00
Authentication code: 1152

Magick: memory allocation failed `imagePath' @ error/bmp.c/ReadBMPImage/941

Post by umair.xdoz » 2018-01-10T18:54:49-07:00

I am writing a c++ code and trying to crop an image. However, it fails at the initialisation after a few iterations.

The function is being called in a library inside a loop and it works fine a few times (twice).

Is there any way of deallocating the memory after operations have been performed on an image ?

My code is below:

Code: Select all

Image imageMagic(imagePath);
imageMagic.crop(Geometry(699, 150, 198, 625));
imageMagic.write(labelName);
is theer anything like image.dealloc or something which frees up the memory every time it has been used ?

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

Re: Magick: memory allocation failed `imagePath' @ error/bmp.c/ReadBMPImage/941

Post by snibgo » 2018-01-10T21:04:26-07:00

Your code doesn't have a loop.

My understanding is that Magick++ will automatically free memory (by "destructor") for an Image structure when it is no longer a valid reference. So the placement of what is inside or outside the loop is important.
snibgo's IM pages: im.snibgo.com

Post Reply