<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/DgsGIFGetSize?action=history&amp;feed=atom</id>
	<title>DgsGIFGetSize - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/DgsGIFGetSize?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsGIFGetSize&amp;action=history"/>
	<updated>2026-05-03T03:27:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsGIFGetSize&amp;diff=82412&amp;oldid=prev</id>
		<title>Lettify: Created page with &quot;__NOTOC__  {{Client function}}  Returns the dimensions (width and height) of a GIF element created using dgsCreateGIF. The values correspond to the original size extracted from the GIF file during loading.  ==Syntax==  &lt;syntaxhighlight lang=&quot;lua&quot;&gt; int int dgsGIFGetSize( element gif ) &lt;/syntaxhighlight&gt;   ===Required Arguments=== *'''gif: ''' The '''dgs-dxgif''' type element you want to get the size of.  ===Returns=== Returns two integers corresponding to ''width'' an...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsGIFGetSize&amp;diff=82412&amp;oldid=prev"/>
		<updated>2025-08-23T22:59:08Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__  {{Client function}}  Returns the dimensions (width and height) of a GIF element created using &lt;a href=&quot;/wiki/DgsCreateGIF&quot; title=&quot;DgsCreateGIF&quot;&gt;dgsCreateGIF&lt;/a&gt;. The values correspond to the original size extracted from the GIF file during loading.  ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; int int dgsGIFGetSize( element gif ) &amp;lt;/syntaxhighlight&amp;gt;   ===Required Arguments=== *&amp;#039;&amp;#039;&amp;#039;gif: &amp;#039;&amp;#039;&amp;#039; The &amp;#039;&amp;#039;&amp;#039;dgs-dxgif&amp;#039;&amp;#039;&amp;#039; type element you want to get the size of.  ===Returns=== Returns two integers corresponding to &amp;#039;&amp;#039;width&amp;#039;&amp;#039; an...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
&lt;br /&gt;
Returns the dimensions (width and height) of a GIF element created using [[dgsCreateGIF]]. The values correspond to the original size extracted from the GIF file during loading.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int int dgsGIFGetSize( element gif )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''gif: ''' The '''dgs-dxgif''' type element you want to get the size of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns two integers corresponding to ''width'' and ''height''&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- This script should be executed on the client-side&lt;br /&gt;
&lt;br /&gt;
-- Import the DGS functions to use them from another resource&lt;br /&gt;
local DGS = exports.dgs&lt;br /&gt;
&lt;br /&gt;
-- 1. Load the GIF from a file within your resource&lt;br /&gt;
local myAnimatedGif = DGS.dgsCreateGIF(&amp;quot;files/loading.gif&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- 2. Check if the GIF was loaded successfully before proceeding&lt;br /&gt;
if myAnimatedGif then&lt;br /&gt;
    -- 3. Use dgsGIFGetSize to get the width and height of the loaded GIF&lt;br /&gt;
    local width, height = DGS.dgsGIFGetSize(myAnimatedGif)&lt;br /&gt;
&lt;br /&gt;
    -- 4. Display the dimensions in the chat to confirm the result&lt;br /&gt;
    outputChatBox(string.format(&amp;quot;The loaded GIF has the dimensions: %d width by %d height.&amp;quot;, width, height))&lt;br /&gt;
&lt;br /&gt;
    -- 5. Practical example: Create a DGS image in the center of the screen&lt;br /&gt;
    --    using the 'width' and 'height' we just obtained so the size is perfect.&lt;br /&gt;
    local screenW, screenH = guiGetScreenSize()&lt;br /&gt;
    local posX = screenW / 2 - width / 2&lt;br /&gt;
    local posY = screenH / 2 - height / 2&lt;br /&gt;
&lt;br /&gt;
    local gifImage = DGS.dgsCreateImage(posX, posY, width, height, myAnimatedGif, false)&lt;br /&gt;
&lt;br /&gt;
    -- Start the GIF's animation&lt;br /&gt;
    DGS.dgsGIFPlay(myAnimatedGif)&lt;br /&gt;
else&lt;br /&gt;
    -- Inform the user if the GIF was not found or if an error occurred during loading&lt;br /&gt;
    outputChatBox(&amp;quot;Error: Could not load the GIF file.&amp;quot;, 255, 0, 0)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{DGS_Plugin/Gif}}&lt;/div&gt;</summary>
		<author><name>Lettify</name></author>
	</entry>
</feed>