How to Get the Actual Position and Size of the Exported Image in PPT after Applying 3D Transformation?

I can obtain the width and height of an element through shape.Width and shape.Height, and I can get the position of the element using shape.X and shape.Y. Additionally, I can export this element as an image. However, if the element has perspective or 3D rotation applied, the exported image becomes skewed, causing the original position and size of the element to be inaccurate. How can I get the actual size and position of the transformed element in the PPT?

@raining,
Thank you for posting the question.

Please note that you can convert a shape from a PowerPoint presentation to an image as follows:

var scaleX = 2;
var scaleY = scaleX;

using var presentation = new Presentation("sample.pptx");
var shape = presentation.Slides[0].Shapes[0];
            
using var image = shape.GetImage(ShapeThumbnailBounds.Shape, scaleX, scaleY);
image.Save("output.png", ImageFormat.Png);

I hope this will help you. The attached file contains an example of a PowerPoint presentation with a shape rotated along the X, Y, and Z axes. The output file is correct.
sample.zip (27.7 KB)

If this approach does not work for you, please share the following files and information:

  • sample presentation file
  • code example to reproduce the problem
  • output image file
  • Aspose.Slides version you used