DaSpamer Grandmaster Cheater Supreme Reputation: 52 Joined: 13 Sep 2011 Posts: 1578
|
Posted: 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 https://github.com/Egor-Skriptunoff/pure_lua_GIF);
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.
EDIT:
This is the whole script (gif decoder & bitmap encoder), source (contains also the example): https://pastebin.com/mX1f4FUM
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.
Code: | local _internet
function getImageString(url)
_internet = (_internet or getInternet());
return _internet.getURL(url);
end
local f = createForm();
f.autosize = true; -- auto size to image size
local i = createImage(f);
-- get gif information and extract it;
local gifString = getImageString('https://media.tenor.com/images/dfb11ec7ee94e551ceeac653ce636d21/tenor.gif')
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;
i.Picture.loadFromStream(stream);
id = id + 1;
end |
(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.
preview:
Cannot post this script here cause of the darn cloudflare quick trigger, so have a pastebin url.
https://pastebin.com/NRvJkrY5
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!
http://forum.cheatengine.org/viewtopic.php?t=564919
Last edited by DaSpamer on Thu May 23, 2019 10:04 am; edited 5 times in total
|
|