a:blipFill (Picture Fill)
Represents a picture or image fill for shapes, including blip content, fill properties, and stretch/tile options.
Description
\:blipFill\ is the DrawingML element that applies a picture (image) fill to a shape. It is defined in ECMA-376 Part 1 §20.1.8.14.
Picture fills enable shapes to be filled with embedded or linked images, supporting various image formats and fill modes. Unlike solid fills or gradients, picture fills incorporate actual image content (JPG, PNG, BMP, GIF, etc.) into the shape.
Key capabilities:
- Embed or reference external images
- Control image positioning and scaling within shape bounds
- Stretch images to fill shape or tile them
- Apply cropping via source rectangle (\:srcRect)
- Support image transformations and effects
Picture fills are essential for:
- Photo-based designs and layouts
- Product presentations with images
- Background images for shapes
- Pattern-based designs using tiled images
- Complex visual compositions
Attributes
| Attribute | Type | Possible Values | Default | Description |
|---|---|---|---|---|
| (none) | - | - | - | \:blipFill\ has no attributes; behavior controlled via child elements. |
Content Model
\:blipFill\ structure:
- a:blip (required, 1) — The image/blip reference or embedded content
- a:srcRect (optional, 0–1) — Crop rectangle; specifies source image region to use
- Fill Mode (required, choose 1):
- a:stretch — Stretch image to fill entire shape
- a:tile — Tile (repeat) image to fill shape
Child Elements Table
| Element | Occurrence | Type | Description |
|---|---|---|---|
| \:blip\ | 1 | Blip Reference | Embedded or linked image content. Contains alpha modifiers for transparency. |
| \:srcRect\ | 0–1 | Source Rectangle | Crop region; defines which portion of source image to use. Coordinates as percentages of image dimensions. |
| \:stretch\ | 0–1 | Stretch Mode | Fill shape by stretching image to fit bounds (no tiling). Mutually exclusive with \:tile. |
| \:tile\ | 0–1 | Tile Mode | Fill shape by repeating/tiling image (mutually exclusive with \:stretch). |
Examples
Basic Picture Fill (Stretched)
<a:spPr>
<a:xfrm>
<a:off x="1000000" y="1000000"/>
<a:ext cx="5000000" cy="3000000"/>
</a:xfrm>
<a:blipFill>
<a:blip r:embed="rId4"/>
<a:stretch/>
</a:blipFill>
</a:spPr>
using DocumentFormat.OpenXml.Drawing;
using DocumentFormat.OpenXml.Packaging;
var shapeProperties = new ShapeProperties();
var transform = new Transform2D();
transform.Append(new Offset { X = 1000000, Y = 1000000 });
transform.Append(new Extents { Cx = 5000000, Cy = 3000000 });
shapeProperties.Append(transform);
var blipFill = new BlipFill();
var blip = new Blip { Embed = "rId4" }; // Reference to image part
blipFill.Append(blip);
blipFill.Append(new Stretch());
shapeProperties.Append(blipFill);
Tiled Picture Fill
<a:blipFill>
<a:blip r:embed="rId5">
<a:alphaModFix amt="70000"/>
</a:blip>
<a:tile sx="100000" sy="100000" tx="0" ty="0"/>
</a:blipFill>
var blipFill = new BlipFill();
var blip = new Blip { Embed = "rId5" };
var alpha = new AlphaModulationFixed { Amount = 70000 }; // 70% opacity
blip.Append(alpha);
blipFill.Append(blip);
var tile = new Tile
{
ScaleX = 100000, // Scale 1x
ScaleY = 100000,
TranslateX = 0,
TranslateY = 0
};
blipFill.Append(tile);
Picture Fill with Crop (Source Rectangle)
<a:blipFill>
<a:blip r:embed="rId6"/>
<a:srcRect l="25000" t="25000" r="25000" b="25000"/>
<a:stretch/>
</a:blipFill>
var blipFill = new BlipFill();
var blip = new Blip { Embed = "rId6" };
blipFill.Append(blip);
// Crop 25% from each edge
var srcRect = new SourceRectangle
{
Left = 25000,
Top = 25000,
Right = 25000,
Bottom = 25000
};
blipFill.Append(srcRect);
blipFill.Append(new Stretch());
Tiled Background Pattern
<a:blipFill>
<a:blip r:embed="rId7">
<a:duotone>
<a:srgbClr val="4472C4"/>
<a:srgbClr val="FFFFFF"/>
</a:duotone>
</a:blip>
<a:tile sx="50000" sy="50000" tx="0" ty="0"/>
</a:blipFill>
var blipFill = new BlipFill();
var blip = new Blip { Embed = "rId7" };
var duotone = new Duotone();
duotone.Append(new RgbColorModelHex { Val = "4472C4" });
duotone.Append(new RgbColorModelHex { Val = "FFFFFF" });
blip.Append(duotone);
blipFill.Append(blip);
// Tile at 0.5x scale
var tile = new Tile
{
ScaleX = 50000, // 50% scale
ScaleY = 50000,
TranslateX = 0,
TranslateY = 0
};
blipFill.Append(tile);
Picture with Transparency
<a:blipFill>
<a:blip r:embed="rId8">
<a:alphaModFix amt="50000"/>
</a:blip>
<a:srcRect/>
<a:stretch/>
</a:blipFill>
var blipFill = new BlipFill();
var blip = new Blip { Embed = "rId8" };
// 50% opacity
var alpha = new AlphaModulationFixed { Amount = 50000 };
blip.Append(alpha);
blipFill.Append(blip);
blipFill.Append(new SourceRectangle()); // No crop
blipFill.Append(new Stretch());
Fill Mode Reference
Stretch Mode
Stretches/scales image to fill entire shape bounds:
| Property | Value | Meaning |
|---|---|---|
| Fill type | Stretch | Image scales to fit shape dimensions |
| Aspect ratio | May change | Image may distort if shape aspect differs |
| Tiling | No | Image appears once, scaled |
| Performance | Efficient | No tiling calculations |
Tile Mode
Repeats image pattern to fill shape:
| Property | Value | Meaning |
|---|---|---|
| Fill type | Tile | Image repeats in pattern |
| Scale (sx, sy) | 100000+ | Percentage scale; 100000 = 100% (1x) |
| Translate (tx, ty) | Offset | Pixel shift for tiling offset |
| Aspect ratio | Preserved | Each tile maintains original proportions |
Blip Reference Types
| Type | Format | Example |
|---|---|---|
| Embedded (r:embed) | Relationship ID | \ |
| :embed=”rId4”\ — Image embedded in package | ||
| External (r:link) | URL/Path | \ |
| :link=”http://example.com/image.jpg”\ — External link |
Crop Rectangle Coordinates
Source rectangle (\:srcRect) uses percentages:
| Attribute | Type | Range | Meaning |
|---|---|---|---|
| \l\ (left) | Percentage | 0–100000 | Crop from left edge |
| \ \ (top) | Percentage | 0–100000 | Crop from top edge |
| \ | |||
| \ (right) | Percentage | 0–100000 | Crop from right edge |
| \\ (bottom) | Percentage | 0–100000 | Crop from bottom edge |
Example: \l=”25000” t=”25000” r=”25000” b=”25000”\ = crop 25% from all sides
Image Transformation & Effects
Transparency
Use \:alphaModFix\ or \:alphaMod\ to adjust opacity:
<a:blip r:embed="rId9">
<a:alphaModFix amt="75000"/>
</a:blip>
var blip = new Blip { Embed = "rId9" };
var alpha = new AlphaModulationFixed { Amount = 75000 }; // 75% opacity
blip.Append(alpha);
Duotone (Two-Color) Effect
<a:blip r:embed="rId10">
<a:duotone>
<a:srgbClr val="000000"/>
<a:srgbClr val="FFFFFF"/>
</a:duotone>
</a:blip>
var blip = new Blip { Embed = "rId10" };
var duotone = new Duotone();
duotone.Append(new RgbColorModelHex { Val = "000000" }); // Black
duotone.Append(new RgbColorModelHex { Val = "FFFFFF" }); // White
blip.Append(duotone);
Common Patterns
Full-Bleed Background Image (No Crop)
`
Repeating Pattern Texture
`
Thumbnail/Preview Image
`
Notes
Element Relationships
- Parents: Shape properties (\:spPr), group shape properties (\:grpSpPr), connector shape properties (\:cxnSpPr)
- Blip Reference: Required; establishes relationship to image part in package
- Fill Mode: Mutually exclusive; choose \:stretch\ OR \:tile\, not both
- Source Rectangle: Optional crop; defaults to no crop if omitted
Implementation Details
- Image Formats: JPG, PNG, BMP, GIF, TIFF, WMF, EMF supported
- Embedding: Images can be embedded (r:embed) or linked (r:link)
- Performance: Embedded images increase file size; linked images require external access
- Tiling: Scale values are percentage-based (100000 = 100% = 1x scale)
- Crop: Coordinates are percentages of image dimensions
- Transparency: Applies over base image; useful for watermarks or overlays
- Office Rendering: Consistent across Word, PowerPoint, Excel for image fills
- Image Quality: Tiled small images may appear pixelated; consider resolution when tiling
- Accessibility: Provide alt text for accessibility; use \:blip\ with accessible name property
- File Size: Embedded images impact package file size; linked images require network access
- Compatibility: Picture fills supported in Office 2007 and later