BlackThresholdImage() use in c++ application

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rich2449
Posts: 11
Joined: 2010-03-18T11:34:10-07:00
Authentication code: 8675308

BlackThresholdImage() use in c++ application

Post by rich2449 »

What is the correct way to access the function BlackThresholdImage() in a c++ application?

I'm starting to use Magick++, which does not appear to have this function. I can see the function in magick\threshold.cpp, but am unsure of the correct method of accessing this function.

Googling around has not enlightened me, the function does not appear to be in the image class, or in the magick:: namespace, so rather than start hacking it in, I figured it's worth asking in here.

Thanks in advance, Rich
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: BlackThresholdImage() use in c++ application

Post by magick »

Not all MagickCore methods are supported with Magick++, instead you can access MagickCore methods in Magick++ with the MagickCore namespace, e.g. MagickCore::BlackThresholdImage().
rich2449
Posts: 11
Joined: 2010-03-18T11:34:10-07:00
Authentication code: 8675308

Re: BlackThresholdImage() use in c++ application

Post by rich2449 »

Eureka!

When using MagicCore functions on Magick++ image objects are any precautions needed to make the image object aware that the underlying image may have changed? From the looks of things, so long as I call modifyImage() before using the MagickCore function I should be fine?

Code: Select all

   Magick::Image test_image;
   // .. load up image here
   image_test.modifyImage();
   MagickCore::BlackThresholdImage( test_image.image(), "25%" );

Thank you!
Last edited by rich2449 on 2010-03-18T12:27:40-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: BlackThresholdImage() use in c++ application

Post by magick »

It wouldn't hurt to call modifyImage() but I believe modifyImage() was introduced before we had a robust implementation of reference counted image objects.
rich2449
Posts: 11
Joined: 2010-03-18T11:34:10-07:00
Authentication code: 8675308

Re: BlackThresholdImage() use in c++ application

Post by rich2449 »

Thank you!

I agree, from the looks of the code calling modifyImage() should be the only function required.

Thank you again, this is great software!
Post Reply