捕获和转换Web的工具

如何自动设置动画GIF的大小?

虽然可以在GrabzIt中精确指定动画GIF应该具有的尺寸,但是您也可以只指定一个尺寸,将另一个尺寸定义为-1。

这会将视频缩放到指定尺寸的大小,其他未指定尺寸的尺寸也将以相同的比例缩小。 但是,未指定尺寸的大小当然会根据源视频的尺寸而变化。

该技术的优势在于,它可以将整个视频按比例缩小到较小的尺寸,而无需填充或裁剪。 下面的示例显示了一个动画GIF,其宽度为200px,高度根据200px宽度与源视频宽度的比率自动调整大小。

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
AnimationOptions options = new AnimationOptions();
options.Width = 200;
options.Height = -1;
grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options);
grabzIt.Save("http://www.mywebsite.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
AnimationOptions options = new AnimationOptions();
options.setWidth(200);
options.setHeight(-1);
grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options);
grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.3.7/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("https://www.youtube.com/watch?v=a1Y73sPHKxw", 
{"format":"gif", "width":200, "height":-1}).Create();
</script>
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
client.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw", 
{"width":200, "height":-1});
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItAnimationOptions->new();
$options->width(200);
$options->height(-1);
$grabzIt->URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", $options);
$grabzIt->Save("http://www.mywebsite.com/handler.pl");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItAnimationOptions();
$options->setWidth(200);
$options->setHeight(-1);
$grabzIt->URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", $options);
$grabzIt->Save("http://www.mywebsite.com/handler.php");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItAnimationOptions.GrabzItAnimationOptions()
options.width = 200
options.height = -1
grabzIt.URLToAnimation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options)
grabzIt.Save("http://www.mywebsite.com/handler.py")
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::AnimationOptions.new()
options.width = 200
options.height = -1
grabzIt.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options)
grabzIt.save("http://www.mywebsite.com/handler/index")

计算时 动画GIF的总分辨率,以确定是否在当前软件包中允许使用,而是使用非自动调整尺寸的值。