Image scaling
Use the scaling
option to control how an image is adjusted for a given placeholder shape.
With {"scaling": "contain"}
, the image is resized to fit within the shape.
With {"scaling": "cover"}
, the image is resized to cover the entire shape. As a result, the image may overflow either horizontally or vertically.
When scaling is unspecified or null
, the image is placed as-is according to its intrinsic size.
Reference: the Image object
Download: input.zip · output.pptx
template.pptx
1
![template.pptx slide 1](/examples/en/041-image-scaling/template/slide1.png)
output.pptx
1
![output.pptx slide 1](/examples/en/041-image-scaling/output/slide1.png)
2
![output.pptx slide 2](/examples/en/041-image-scaling/output/slide2.png)
3
![output.pptx slide 3](/examples/en/041-image-scaling/output/slide3.png)
data.json
{
"slides": [
{
"template": 1,
"slide-title": "\"scaling\": \"contain\"",
"hedgehog": {
"type": "image",
"src": "hedgehog.jpg",
"scaling": "contain"
}
},
{
"template": 1,
"slide-title": "\"scaling\": \"cover\"",
"hedgehog": {
"type": "image",
"src": "hedgehog.jpg",
"scaling": "cover"
}
},
{
"slide-title": "\"scaling\": null",
"template": 1,
"hedgehog": {
"type": "image",
"src": "hedgehog.jpg"
}
}
]
}