Inline shape size

The position of an inline shape is completely determined by the text it is inline with, however its dimensions can be specified. For some shape types, both the contained shape and the shape container specify a width and height. In the case of a picture, the dimensions of the inline shape (container) determine the display size while the dimension of the pic element determine the “original size” of the image.

Candidate protocol – inline shape access

The following interactive session illustrates the protocol for accessing and changing the size of an inline shape:

>>> inline_shape = inline_shapes[0]
>>> assert inline_shape.type == MSO_SHAPE_TYPE.PICTURE
>>> inline_shape.width
>>> inline_shape.height
>>> inline_shape.width = 457200
>>> inline_shape.height = 228600
>>> inline_shape.width, inline_shape.height
457200, 228600

Specimen XML

This XML represents an inline shape inserted inline on a paragraph by itself:

      <wp:inline distT="0" distB="0" distL="0" distR="0" wp14:anchorId="1BDE1558" wp14:editId="31E593BB">
        <wp:extent cx="859536" cy="343814"/>
        <wp:effectExtent l="0" t="0" r="4445" b="12065"/>
        <wp:docPr id="1" name="Picture 1"/>
          <a:graphicFrameLocks xmlns:a="" noChangeAspect="1"/>
        <a:graphic xmlns:a="">
          <a:graphicData uri="">

            <pic:pic xmlns:pic="">
                <pic:cNvPr id="1" name="python-powered.png"/>
                <a:blip r:embed="rId7">
                    <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
                      <a14:useLocalDpi xmlns:a14="" val="0"/>
                  <a:off x="0" y="0"/>
                  <a:ext cx="859536" cy="343814"/>
                <a:prstGeom prst="rect">