What are the units for the crop attributes in the imagedata element of WordML?

StackOverflow https://stackoverflow.com/questions/8256217

  •  08-03-2021
  •  | 
  •  

Question

I am trying to extract images from a document saved as WordML. Some of the images are cropped from a single resource using attributes on the imagedata element eg:

<v:imagedata r:id="rId8" o:title="" cropbottom="32429f" cropright="44328f"/>

What are the units for the cropbottom and cropright attributes?

I have done some web searching and according to http://msdn.microsoft.com/en-us/library/bb229565%28v=vs.85%29.aspx the units should be percentages but don't seem to be.

In the example above the resulting image should come from the top left of the original and be a third of the width and half the height.

Was it helpful?

Solution

I'll answer my own question in the hope that it is useful to someone else.

According to ImageData Class - Office 2010

CropBottom ... specifies the how much to crop the image from the bottom up as a fraction of picture size. Default is 0. This numeric value can also be specified in 1/65536-ths if a trailing "f" is supplied. For example, a value of "52429f" represents 52429/65536 or 0.8.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top