Reset all Image Attributes

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
jeroenooms
Posts: 4
Joined: 2017-07-24T01:26:54-07:00
Authentication code: 1151

Reset all Image Attributes

Post by jeroenooms » 2017-07-24T01:41:39-07:00

Is there an easy way to reset all attributes on an Image object to their original (blank) state ?

A common problem that I experience in my application is that the behavior of some method is affected by some image attribute that was set by a previous operation.

For example we might draw some text. So we set image->fillColor() and image->fontPointsize() and then call with image-> annotate() with our text. However if some previous operation on the image might have set a fontWeight or boxColorImage, then these are also applied to our text which we did not intend.

So I guess what we need to get predictable behavior is to reset the attributes before staring our new operation?

image->reset()
image->fillColor()
image->fontPointsize()
image-> annotate()

Or perhaps I am doing this wrong and there is a way to specify which attributes a method should use?

Post Reply