Appearance
@shbernal/ts-pptx / index / ImageBaseProps
Interface: ImageBaseProps
Defined in: src/types/media.ts:14
Extends
Extended by
Properties
altText?
optionalaltText?:string
Defined in: src/types/media.ts:34
Alt Text value ("How would you describe this object and its contents to someone who is blind?")
- PowerPoint: [right-click on an image] > "Edit Alt Text..."
Overrides
biLevel?
optionalbiLevel?:object
Defined in: src/types/media.ts:224
Recolor the image to two-level black & white (<a:biLevel thresh="…"/>)
- every pixel at/above the luminance threshold becomes white, everything below it black (MS-PPT > Format Picture > Picture Color > Recolor > Black and White …%)
threshold
threshold:
number
Luminance split point as a 0.0–1.0 fraction (serialized to thresh, the 0–1 fraction ×100000).
Example
ts
{ threshold: 0.5 } // split at 50% luminanceclrChange?
optionalclrChange?:object
Defined in: src/types/media.ts:235
Recolor the image by mapping one source color to another (<a:clrChange>)
- every pixel matching
fromis repaintedto— the classic "swap the flat background out" recolour (MS-PPT > Format Picture > Picture Color > Set Transparent Color is the single-colour sibling) - colors accept
HexColororThemeColor, same as fills /duotone
from
from:
string
Source color to replace (<a:clrFrom>).
to
to:
string
Replacement color (<a:clrTo>).
Example
ts
{ from: '000000', to: 'FF0000' } // turn black pixels redcrop?
optionalcrop?:object
Defined in: src/types/media.ts:125
Crop the source image to a sub-region by percentage edge insets, emitted verbatim as OOXML <a:srcRect>.
- each value is the percent (0–100) trimmed off that edge of the source image, the same model PowerPoint's Picture Format > Crop uses;
l+randt+bmust each be < 100 - the remaining sub-region is stretched to fill the picture's displayed
w×hbox, so this is the faithful way to reproduce a deck that maps several icons out of one composite raster - operates on the source image directly (independent of natural-pixel measurement), so unlike
sizing: 'crop'(which crops in displayed inches) it works for SVG and unmeasurable formats - mutually exclusive with sizing; if both are set
cropwins andsizingis ignored
b?
optionalb?:number
Percent (0–100) trimmed from the bottom edge of the source image.
Default
ts
0l?
optionall?:number
Percent (0–100) trimmed from the left edge of the source image.
Default
ts
0r?
optionalr?:number
Percent (0–100) trimmed from the right edge of the source image.
Default
ts
0t?
optionalt?:number
Percent (0–100) trimmed from the top edge of the source image.
Default
ts
0Example
ts
{ l: 0, t: 0, r: 50, b: 50 } // keep the top-left quadrant of the source imageduotone?
optionalduotone?:object
Defined in: src/types/media.ts:202
Recolor the image as a two-tone (duotone) effect
- maps the image's shadows to
shadowand its highlights tohighlight - serializes
<a:duotone>inside the picture's<a:blip>(MS-PPT > Format Picture > Picture Color > Recolor) - colors accept
HexColororThemeColor, same as fills - the classic brand treatment: tint stock photography into a single brand hue
highlight
highlight:
string
Color mapped to the image's light/highlight tones.
shadow
shadow:
string
Color mapped to the image's dark/shadow tones.
Example
ts
{ shadow: '250F6B', highlight: 'FFFFFF' } // deep-blue duotoneflipH?
optionalflipH?:boolean
Defined in: src/types/media.ts:39
Flip horizontally?
Default
ts
falseflipV?
optionalflipV?:boolean
Defined in: src/types/media.ts:44
Flip vertical?
Default
ts
falsegrayscale?
optionalgrayscale?:boolean
Defined in: src/types/media.ts:217
Recolor the image to grayscale (<a:grayscl/>)
- maps every pixel to its luminance grey (MS-PPT > Format Picture > Picture Color > Recolor > Grayscale)
- the cheapest recolour: no payload
- mutually exclusive with the other recolour modes (
duotone/biLevel/clrChange); if several are set, the first present in document order wins on read-back
Default
ts
falseExample
ts
true // desaturate the imageh?
optionalh?:Coord
Defined in: src/types/core.ts:49
Height
- inches or percentage
Examples
ts
10.25 // height in inchests
'75%' // height as percentage of slide sizeInherited from
hyperlink?
optionalhyperlink?:HyperlinkProps
Defined in: src/types/media.ts:45
line?
optionalline?:ShapeLineProps
Defined in: src/types/media.ts:53
Border line (<a:ln> outline) drawn around the image
- same options as a shape outline; a picture supports a single outline, not per-side borders
- MS-PPT: Format Picture > Line
Examples
ts
{ color: '0088CC', width: 2 } // 2pt blue borderts
{ color: '666666', width: 1, dashType: 'dash' } // dashed gray borderobjectLock?
optionalobjectLock?:ObjectLockProps
Defined in: src/types/object.ts:54
Object lock flags (DrawingML a:spLocks / a:picLocks / a:graphicFrameLocks)
- restrict how the object can be manipulated in PowerPoint (e.g. prevent moving, resizing, or grouping)
- each flag maps 1:1 to the OOXML attribute of the same name; only flags set to
trueare emitted - PowerPoint UI: Selection Pane / right-click protections (most locks are honored at edit time, not as a password)
- flags only apply to the object types that support them (see each flag); flags set on an unsupported object type are ignored with a console warning
Examples
ts
{ noMove: true, noResize: true } // pin an object in placets
{ noGrp: true } // exclude from groupingInherited from
objectName?
optionalobjectName?:string
Defined in: src/types/object.ts:36
Object name
- used instead of default "Object N" name
- PowerPoint: Home > Arrange > Selection Pane...
Default
ts
'Object 1'Example
ts
'Antenna Design 9'Inherited from
placeholder?
optionalplaceholder?:string
Defined in: src/types/media.ts:62
Name of a picture placeholder defined on the slide layout/master to populate
- when it matches a layout/master placeholder, the image inherits that placeholder's position and size for any of
x/y/w/hnot supplied explicitly; explicit values always win
Example
ts
'picph'See
https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppplaceholdertype
points?
optionalpoints?:GeometryPoint[]
Defined in: src/types/media.ts:92
Clip the image to an arbitrary freeform path (custGeom)
- takes precedence over
shape/roundingwhen present - coordinates are authored in the image's own inch/EMU space (0..w, 0..h), not slide-relative and not normalized
- supports the same path DSL as freeform shapes:
moveTo/lnTo/cubicBezTo/quadBezTo/arcTo/close
Example
ts
[{ x: 1, y: 0 }, { x: 2, y: 2 }, { x: 0, y: 2 }, { close: true }] // triangular photo cliprectRadius?
optionalrectRadius?:number
Defined in: src/types/media.ts:98
Rounded rectangle corner radius (inches) when shape: 'roundRect'
- values: 0.0 to 1.0
Default
ts
0rotate?
optionalrotate?:number
Defined in: src/types/media.ts:69
Image rotation (degrees)
- range: -360 to 360
Default
ts
0Example
ts
180 // rotate image 180 degreesrounding?
optionalrounding?:boolean
Defined in: src/types/media.ts:75
Enable image rounding (clips the image to a circle/ellipse)
- shorthand for
shape: 'ellipse';shapetakes precedence when both are set
Default
ts
falseshadow?
optionalshadow?:ShadowProps
Defined in: src/types/media.ts:112
Shadow Props
- MS-PPT > Format Picture > Shadow
Example
ts
{ type: 'outer', color: '000000', transparency: 50, blur: 20, offset: 20, angle: 270 }shape?
optionalshape?:SHAPE_NAME
Defined in: src/types/media.ts:84
Clip the image to a preset shape geometry ("fit image into shape")
- accepts any PowerPoint preset geometry name, e.g.
'roundRect','hexagon','ellipse' - combine with
sizing: { type: 'cover', ... }for an aspect-correct fill of the shape box - use
rectRadiusto set the corner radius for'roundRect'
Examples
ts
'roundRect' // rounded-rectangle avatarts
'hexagon' // hexagonal photoshapeAdjust?
optionalshapeAdjust?:ShapeAdjustValue|ShapeAdjustValue[]
Defined in: src/types/media.ts:105
Preset-geometry adjustment handles (<a:avLst> guides) for the clip shape.
- tune adjustment handles that lack a dedicated option, e.g. chevron point depth
- accepts a single guide or an array; each
valueis a0.0–1.0fraction (see ShapeAdjustValue)
Example
ts
{ name: 'adj', value: 0.25 }sizing?
optionalsizing?:object
Defined in: src/types/media.ts:140
Image sizing options
- omit entirely for the default: a raster fills the
w×hbox, a vector (SVG) source is letterboxed to its own aspect ratio inside that box
h?
optionalh?:Coord
Image height
- inches or percentage
- defaults to the picture's own
h
Examples
ts
10.25 // position in inchests
'75%' // position as percentage of slide sizetype
type:
"contain"|"crop"|"cover"|"stretch"
Sizing type
cover/containfit the image into thew×hbox using the image's natural aspect ratio — read from the embedded PNG/JPEG/GIF/BMP/WebP header, or from an SVG'swidth/heightorviewBox. If the natural size cannot be determined (an unrecognized format, or an SVG carrying neither) the displayedw/hratio is used as a fallback and a warning is logged.cropcuts a window out of the displayed image using thex/y/w/hoffsets.stretchfills the box regardless of aspect ratio. This is what a raster does anyway; name it explicitly to opt a vector source out of its aspect-correct default.
w?
optionalw?:Coord
Image width
- inches or percentage
- defaults to the picture's own
w, which is whatcover/containalmost always want
Examples
ts
10.25 // position in inchests
'75%' // position as percentage of slide sizex?
optionalx?:Coord
Offset from left to crop image
croponly- inches or percentage
Examples
ts
10.25 // position in inchests
'75%' // position as percentage of slide sizey?
optionaly?:Coord
Offset from top to crop image
croponly- inches or percentage
Examples
ts
10.25 // position in inchests
'75%' // position as percentage of slide sizesvg?
optionalsvg?:string
Defined in: src/types/media.ts:247
Raw SVG markup to embed as the image source
- convenience for
data: 'data:image/svg+xml;base64,...'; ts-pptx encodes it for you - ignored when
dataorpathis also provided
Example
ts
'<svg viewBox="0 0 24 24">...</svg>'transparency?
optionaltransparency?:number
Defined in: src/types/media.ts:193
Transparency (percent)
- MS-PPT > Format Picture > Picture > Picture Transparency > Transparency
- range: 0-100
Default
ts
0Example
ts
25 // 25% transparentw?
optionalw?:Coord
Defined in: src/types/core.ts:56
Width
- inches or percentage
Examples
ts
10.25 // width in inchests
'75%' // width as percentage of slide sizeInherited from
x?
optionalx?:Coord
Defined in: src/types/core.ts:35
Horizontal position
- inches or percentage
Examples
ts
10.25 // position in inchests
'75%' // position as percentage of slide sizeInherited from
y?
optionaly?:Coord
Defined in: src/types/core.ts:42
Vertical position
- inches or percentage
Examples
ts
10.25 // position in inchests
'75%' // position as percentage of slide size