padavan
padavan

Reputation: 884

FFmpeg Images resize to fill with crop like `cover`

Hello i have image sequence difference sizes (example 4 images screen1). I want save aspect ratio to fill output size 300x400. If image side out - crop. In web it named 'image cover'. need output result on screen2. Green brush say about side crop.

enter image description here

enter image description here

Upvotes: 0

Views: 801

Answers (1)

llogan
llogan

Reputation: 134173

Example using scale, crop, and xstack:

ffmpeg -i topleft.jpg -i topright.jpg -i bottomleft.jpg -i bottomright.jpg -filter_complex "[0]scale=150:200:force_original_aspect_ratio=increase,crop=150:200[tl];[1]scale=150:200:force_original_aspect_ratio=increase,crop=150:200:0:0[tr];[2]scale=150:200:force_original_aspect_ratio=increase,crop=150:200[bl];[3]scale=150:200:force_original_aspect_ratio=increase,crop=150:200[br];[tl][tr][bl][br]xstack=inputs=4:layout=0_0|w0_0|0_h0|w0_h0[v]" -map "[v]" -frames:v 1 output.jpg

Upvotes: 2

Related Questions