Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cheat Engine Forum Index
PostGo back to topic
Grandmaster Cheater Supreme
Reputation: 30
Joined: 13 Sep 2011
Posts: 1510

PostPosted: Wed May 22, 2019 5:55 pm    Post subject: decoding GIF to bitmap frames [script]

Seen a post recently on how to animate an image.
So came up with this solution, by using Egor-Skriptunoff GIF decoder library (source;
we're able to decode GIF image into nested table pixels.
And then we can encode it into bitmap format, using this function I wrote.

This is the whole script (gif decoder & bitmap encoder), source (contains also the example):

Modified the extract gif, it should return now a table with each bitmap loaded into a stream and the gif object itself (to get information or what not check script source for more information).

Here's an example,
getting string from internet and supplying the data directly, and creating animation.

local _internet
function getImageString(url)
   _internet = (_internet or getInternet());
   return _internet.getURL(url);

local f = createForm();
f.autosize = true; -- auto size to image size
local i = createImage(f);
-- get gif information and extract it;
local gifString = getImageString('')
bitmapStreams,gif = extractGIF(gifString);
i.width,i.height = gif.get_width_height(); -- set width && height

-- animate the image!
t = createTimer(f);
t.interval = gif.get_image_parameters().delay_in_ms; -- based on first frame delay
local id = 1;
t.onTimer = function(sender)
   id = (id > #bitmapStreams and 1 or id);
   local stream = bitmapStreams[id];
   stream.position = 0;
   id = id + 1;

(old - first script to extract frames and save locally)
Use the following script to extract a GIF image into bitmap frames, afterwards just save it as table file or as string (don't forget to encode it using base64), and use it as you wish, or just use this script on the go with threads.

Cannot post this script here cause of the darn cloudflare quick trigger, so have a pastebin url.

note: it contains an encoded GIF from the internet, change path at the bottom of the script.

Second edit:
Fixed syntax error;
Third edit:
Just encoded it using the CE function an added url to script source.
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

Last edited by DaSpamer on Thu May 23, 2019 10:04 am; edited 5 times in total
Back to top
View user's profile Send private message
Post reviews:   Approve 1
Author Review
Review: Approve
Post reference:
ReviewPosted: Fri May 24, 2019 12:24 pm

Such studies; More beautiful with CE and Lua.
I hope more will come.
Again Thanks.

Back to top
View user's profile Send private message MSN Messenger
Cheat Engine Forum Index

Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites