My gif files are not diplaying but no issues when having it set to .png

Greitaro

New Member
Apr 24, 2020
9
9
I am trying to have a random gif play for this but for some reason the gifs just will not play. When I replace my gifs with .png files and change my code for those the images will display just fine. Am I missing something in my code that gifs specifically need?

<<if $enemytype == 1>>

<<set _rndnbr to random(1,3)>>

<<switch (_rndnbr) >>

<<case 1>>
[img[gifs/1.gif]]

<<case 2>>
[img[gifs/2.gif]]

<<case 3>>
[img[gifs/3.gif]]

<</switch>>
<<endif>>

ps. I know i do have the file location correct because when I was testing this with images I used the same file location and name and only changed the .png extension to .gif

I am running this in twine SugarCube
 
Last edited:
  • Like
Reactions: osanaiko

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,158
3,542
Renpy supported image formats are listed here:


GIF is not one of them.

The options you have are:

1. Convert to a supported movie format like VP8 in Webm container (supported formats listed here )
This is the best choice if your GIF source is from real (porn?) video

2. Pull out the individual frames from the GIF into jpg or png, then assemble into a looping animation using Renpy ATL (
)

This works best for low-framerate stuff like hand drawn animation. Doing 30fps video in an ATL displayable is a lot of coding to make it work and a lot of device resources to load and show - and also large disk space because of so many images are needed without taking advantage of any inter-frame compression like the modern video formats can do.
 
Last edited:
  • Like
Reactions: clowns234

Greitaro

New Member
Apr 24, 2020
9
9
Renpy supported image formats are listed here:


GIF is not one of them.

The options you have are:

1. Convert to a supported movie format like VP8 in Webm container (supported formats listed here )
This is the best choice if your GIF source is from real (porn?) video

2. Pull out the individual frames from the GIF into jpg or png, then assemble into a looping animation using Renpy ATL (
)

This works best for low-framerate stuff like hand drawn animation. Doing 30fps video in an ATL displayable is a lot of coding to make it work and a lot of device resources to load and show - and also large disk space because of so many images are needed without taking advantage of any inter-frame compression like the modern video formats can do.
I apologize I have updated my post now to include this but I am running this code in Twine Sugarcube which from everything I have seen should support gif as a format
 
  • Haha
Reactions: osanaiko

exer

Member
Game Developer
Aug 16, 2017
119
288
I use Sugarcube too, but this code looks nothing like what I've seen or use myself. I'm far from a programmer, which is why I like Twine, but it may just be a formatting issue. Try changing it to a basic HTML field with <img src="file.gif"> instead.
 

Alcahest

Engaged Member
Donor
Game Developer
Jul 28, 2017
3,161
4,059
Gifs should work with that code -- assuming you're playing it in an environment that supports gifs, like any web browser.

Do you see a broken image icon? Then right click on it and open it in a new tab to see what url it is trying to display and you can verify that the file path is correct.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,158
3,542
I apologize I have updated my post now to include this but I am running this code in Twine Sugarcube which from everything I have seen should support gif as a format
Haha, I might have been too hasty with my reply. can't remember no,w but I think it might not have had the code example when I first saw it.

Good luck with your game!
 

Winterfire

Forum Fanatic
Respected User
Game Developer
Sep 27, 2018
4,973
7,292
It's 2024 why are you still using gif, it's a sign from God to finally upgrade to a decent format (WebM)
 
  • Haha
Reactions: osanaiko

Greitaro

New Member
Apr 24, 2020
9
9
Haha, I might have been too hasty with my reply. can't remember no,w but I think it might not have had the code example when I first saw it.

Good luck with your game!
thanks for all the help everyone I did get it sorted out when i went into the files properties it was showing that it was being blocked from access from some programs and once I turned that off it worked fine
 
  • Like
Reactions: osanaiko