LÖVE GIF maker

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil
Contact:

LÖVE GIF maker

Post by HugoBDesigner » Mon Feb 24, 2014 7:37 pm

Hello, guys! My name is Hugo, and I'm new here. I'm not new in LÖVE development, though. I'm from Stabyourself Forums like a few other users here. Well, while "chatting" with some users there, a question appeared: I'm making a mod of a game wrote in LÖVE, and I tried to make an in-game recorder. It works well, but all I can do is export the frames from the recording, but I just haven't figured out how to convert them into GIF. I know it is possible, but not easy. I wonder if some of you guys have something done for it or some kind of "alternative" solution for it.

Oh, and just in case someone already asked it, I'm willing to try making a GIF converter with some help from you guys.

Thanks for the helping!

PS: I'm using LÖVE 0.8.0 for this. The "in-game" recorder is what I used to make my current avatar, but I had to use an external tool to convert the frames into a GIF.
HugoBDesigner - my Twitter
HugoBDesigner - my Blog

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: LÖVE GIF maker

Post by Ranguna259 » Mon Feb 24, 2014 8:04 pm

I think that you'd need the specific gif encoder to do this, which LÖVE doesn't have in it's default decoders/encoders, I might be wrong thought
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil
Contact:

Re: LÖVE GIF maker

Post by HugoBDesigner » Mon Feb 24, 2014 9:02 pm

Yes, I know LÖVE doesn't have this, but, since a lot of people use LÖVE, I thought that perhaps someone managed to make this. If there were a way to "decode" GIFs properly in LÖVE that'd be awesome.

Does somebody here knows how .gif's are wrote? If I managed to learn it, I could make a function for encoding GIFs, like:

encodeGIF(imagesTable, delay(s), loops)


Where "imagesTable" is a table with all the images (imageData), the delay could be a number or a table (to specify the delay to each frame) and loops could be a boolean or number (to specify if it plays once, a number of times or forever).

But thanks for the help, anyway!
HugoBDesigner - my Twitter
HugoBDesigner - my Blog

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: LÖVE GIF maker

Post by Ranguna259 » Mon Feb 24, 2014 10:59 pm

I think you'd have to edit LÖVE's C++ source code and add a gif decode and I don't think anyone has done this already, sorry about that, maybe a dev can help you with this.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

Xugro
Citizen
Posts: 62
Joined: Wed Sep 29, 2010 8:14 pm

Re: LÖVE GIF maker

Post by Xugro » Tue Feb 25, 2014 1:37 am

Here is the official GIF specification (33 pages long):
http://www.w3.org/Graphics/GIF/spec-gif89a.txt

You "just" have to write an encoder. Then you can write the data to a file with love.filesystem.write. Lua-strings can handle the binary data without problems:
Lua is eight-bit clean and so strings may contain characters with any numeric value, including embedded zeros. That means that you can store any binary data into a string.
[...]
We can specify a character in a string also by its numeric value through the escape sequence \ddd, where ddd is a sequence of up to three decimal digits. As a somewhat complex example, the two literals "alo\n123\"" and '\97lo\10\04923"' have the same value, in a system using ASCII: 97 is the ASCII code for a, 10 is the code for newline, and 49 (\049 in the example) is the code for the digit 1.
Source

User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil
Contact:

Re: LÖVE GIF maker

Post by HugoBDesigner » Tue Feb 25, 2014 2:54 am

I already used the string-to-file thing for a data downloader, but this is FROM FAR much more complicated. I thought: "Perhaps .png files and .gif files are similar, but .gif files are just a kind of 'pack' of .png's." I was horribly wrong.

Anyway, thanks for the help, guys! I think I'll have to check something like this in the future, and IF someone manages to get them to work with LOVE. Again, thanks for the help!
HugoBDesigner - my Twitter
HugoBDesigner - my Blog

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests