The following command resizes an image (original.png) while preserving its aspect ratio and saves it as scaled.png.
-i original.png → Specifies the input image file.
-vf scale="160:-1" → Applies a video filter (-vf), scaling the width to 160 pixels while setting the height to -1, which means FFmpeg will automatically calculate the height to maintain the aspect ratio.
-c:v png → Specifies the video codec to use for output, which in this case is PNG (since it’s an image).
-pix_fmt rgba → Ensures the output image has an RGBA pixel format (i.e., Red, Green, Blue, and Alpha transparency channels).
Setting the pixel format is key here because on default, FFmpeg will choose a pixel format which does not have an alpha channel - which required for image/video with transparent background.