We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to obtain the clip information of a image

Attached is a word document with only one image. The image is clipped. I found that the image is represented by a DrawingML object. The “ImageData” property of the object is the whole image data, but not the image clipped. Besides the width and the height of the image, I have not found any properties which represent the clip information ( the top and the left distance of the clipped image to the original whole one). How can I get the clip information of that image?

Hi Jesse,

Thanks for your inquiry. You can use the following code to achieve this:

Document doc = new Document(MyDir + @“clip.docx”);

DrawingML dml = (DrawingML)doc.SelectNodes("//DrawingML")[0];

// to get the cropped DrawingML

dml.GetShapeRenderer().Save(MyDir + “outCropped.png”, new ImageSaveOptions(SaveFormat.Png));

I hope, this helps.

Best regards,