Page 1 of 1

c++ equivalent to splice gravity?

Posted: 2009-09-28T12:31:20-07:00
by ocitalis
I am trying to trim single edges one by one (for counting the number of pixels removed from each side), using Magick++. I can make this work using the command line:

Code: Select all

convert oldimage.PNG -gravity West -background white -splice 5x0 -background black -splice 5x0 newImage.PNG
Like described here http://www.imagemagick.org/Usage/crop/#trim_oneside
Now I am having to use system(strCommandLineCommand); then read the image from the disk, then trim() and chop(), from inside my application, and this is obviously sub-optimal. How can I simulate the splicing gravity from within my program without having to use the command line? splice() only seems to allow splicing onto the north or the east.

Re: c++ equivalent to splice gravity?

Posted: 2009-09-28T16:48:32-07:00
by magick
We added a splice() method to Magick++ in ImageMagick 6.5.6-6 Beta available sometime tomorrow. In the mean-time you can use any MagickCore API method (e.g. MagickCore::SpliceImage()).