使用ffmpeg调整gif大小(缩放)时透明度消失了 [英] Transparency is gone while resizing (scaling) gif using ffmpeg
本文介绍了使用ffmpeg调整gif大小(缩放)时透明度消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ffmpeg重新调整gif图像的大小.我的问题是调整大小时图像的透明度不会提高.在调整透明度的同时如何实现透明度?
I am re-sizing gif images using ffmpeg. My problem is that the transparency of image is not coming while re-sizing. How can I achieve transparency while re-sizing it?
我的ffmpeg命令是:
My ffmpeg command is:
ffmpeg -i input.gif-vf scale=320:240 output_converted_gif.gif
推荐答案
您必须使用 -filter_complex
标志缩放和保留透明度,例如
You have to use the -filter_complex
flag to scale and preserve transparency, e.g.
ffmpeg -i input.gif-vf -filter_complex "[0:v] scale=320:240, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse" output_converted_gif.gif
请参阅: https://superuser.com/a/1362406/1058900
这篇关于使用ffmpeg调整gif大小(缩放)时透明度消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文