Note: MagickReadImageBlob () problems caused by

Today found:

If mw is loaded before specific picture data, then this mw were:

MagickReadImageBlob(mw, data, dataLen)

Running will appear abnormal, it is estimated that memory out of the question.

--------------------------------------------------------------

It seems the right approach:

mw = NewMagickWand();
MagickReadImageBlob(mw, data, dataLen);

or:

; ClearMagickWand (mw) before the first Clear //

MagickReadImageBlob(mw, data, dataLen);

---------------------------------------------------------------

The root of all that: 

https://imagemagick.org/api/magick-image.php#MagickReadImageBlob

MagickReadImageBlob(): reads an image or image sequence from a blob. In all other respects it is like MagickReadImage().

 

https://imagemagick.org/api/magick-image.php#MagickReadImage

MagickReadImage():

MagickReadImage() reads an image or image sequence. The images are inserted jjust before the current image pointer position.

Use MagickSetFirstIterator(), to insert new images before all the current images in the wand, MagickSetLastIterator() to append add to the end, MagickSetIteratorIndex() to place images just after the given index.

MagickReadImage () reads an image or image sequence. Image insertion pointer just before the current image position.

Before MagickSetFirstIterator () for all new image into the current image in the wand, the MagickSetLastIterator () attached to the end, then MagickSetIteratorIndex () inserted after a given index.

 

https://imagemagick.org/api/magick-wand.php#ClearMagickWand

ClearMagickWand() clears resources associated with the wand, leaving the wand blank, and ready to be used for a new set of images.

Guess you like

Origin www.cnblogs.com/personnel/p/12076911.html