Using ImageMagick (convert), you need the follow configurations
- Resize to larger than the required box (note the “^”): -resize “2400x1260^”
- Indicate that it should crop from both sides rather than from the bottom/right: -gravity center
- Indicate the final cropped size: -crop 2400x1260+0+0
- Discard intermediate image settings: +repage
The final command is:
convert input.png -resize "2400x1260^" -gravity center -crop 2400x1260+0+0 +repage output.png