The Media Inspector API is free to use.
The approach above would provide you with most flexibility in terms of creating an image that suits your exact needs.
Instead of creating the image you could also use the scale property with fit set to none. This allows you to keep the original aspect ratio with a custom size within a larger viewport:
{
"timeline": {
"tracks": [
{
"clips": [
{
"asset": {
"type": "image",
"src": "https://loremflickr.com/150/200"
},
"start": 0,
"length": 5,
"fit": "none",
"scale": 0.6667
}
]
}
]
},
"output": {
"format": "jpg",
"size": {
"width": 1280,
"height": 720
}
}
}