Crop with Gravity
Posted: 2015-10-13T01:27:46-07:00
How do I get below command line convert uisng magick++ apis?
convert image.png -gravity center -crop 1500x900+0+0 element.png
Basically want a section of image from its center. I couldn't find any method to set gravity or a crop() which uses gravity option.
UPDATE:
One way to do this is specify the offset values in Geometry, but for that I need resolution of input image. In above eg, width and height of image.png. I didn't find any getters for these in the docs, like getImageGeometry(). Can I get some pointers in this direction?
convert image.png -gravity center -crop 1500x900+0+0 element.png
Basically want a section of image from its center. I couldn't find any method to set gravity or a crop() which uses gravity option.
UPDATE:
One way to do this is specify the offset values in Geometry, but for that I need resolution of input image. In above eg, width and height of image.png. I didn't find any getters for these in the docs, like getImageGeometry(). Can I get some pointers in this direction?