Während die Abmessungen, die ein animiertes GIF haben sollte, in GrabzIt genau angegeben werden können, können Sie auch nur eine Dimension angeben und die andere als -1 definieren.
Dadurch wird das Video auf die Größe der angegebenen Dimension skaliert, die andere nicht spezifizierte Dimension wird ebenfalls im gleichen Verhältnis verkleinert. Die Größe der nicht spezifizierten Abmessung hängt jedoch natürlich von den Abmessungen des Quellvideos ab.
Der Vorteil dieser Technik besteht darin, dass ein gesamtes Video ohne Auffüllen oder Zuschneiden auf eine kleine Größe verkleinert werden kann. Unten sehen Sie ein Beispiel, das ein animiertes GIF mit einer Breite von 200 Pixel zeigt und dessen Höhe abhängig vom Verhältnis der 200 Pixel-Breite zur Breite des Quellvideos automatisch angepasst wird.
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.5.2/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")
https://api.grabz.it/services/convert?key=Sign in to view your Application Key&format=gif&width=200&height=-1&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Da1Y73sPHKxw
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")
Bei der Berechnung der Gesamtauflösung des animierten GIFUm festzustellen, ob dies für Ihr aktuelles Paket zulässig ist, wird stattdessen der Wert der Dimension ohne automatische Größenanpassung verwendet.