捕獲和轉換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.4.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的總分辨率,以確定是否在當前軟件包中允許使用,而是使用非自動調整尺寸的值。