Image Magick c++ interface: Image::extent ignoring gravity?

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
esok
Posts: 2
Joined: 2014-03-05T08:09:18-07:00
Authentication code: 6789

Image Magick c++ interface: Image::extent ignoring gravity?

Post by esok »

I want to create an image programmatically, similar to using the command-line "convert -append". I am successfully using the STL append function to get all my images together in the same one, but they were all left-justified. So now I want to center each of the images horizontally. The Image::extent function seems ideal for this, since it will let me give a geometry, a background color, and a gravity. The geometry and background color settings I use are working, but despite changing the gravity to all sorts of other values, the subimage remains at the left in the final image. Am I using the extent() function wrong? Here's a snippet:

image.extent(Magick::Geometry(h_pixels, image.size().height()), Magick::Color("black"), Magick::CenterGravity);

h_pixels is the new width, and I want to keep the original height. I want to have the original image centered within the new extent.

Edit:
I'm using Version: ImageMagick 6.7.5-6 2012-08-11 Q16
Post Reply