Guidelines:Animated PNGs

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search

Overview
Animated pngs are similar, but preferable, to gifs that we use on Zelda Wiki. It is recommended that you upload png files instead of gifs as these align with our standard of using png files, which means that people looking for a given file are more likely to find a png instead of a gif. Therefore, pngs are more likely to be used than gifs across the site. Some templates such as Template:Gallery List require images to be in PNG format.

See Category:GIF Sprites for a list of GIFs that need to be converted to animated PNGs.

Creating an Animated PNG

There are methods of creating and converting gifs to pngs. The method that we recommend is with GIMP, an open source image editing program. In this process, we will be creating a gif file and converting it into an animated png.

The first step is to have a sprite sheet of the sprite you wish to animate. A good resource for these is The Spriters Resource. When using images provided by other websites, please be sure to attribute the source accordingly.

The second thing you will need is an understanding of how the sprites are meant to appear in-game. Animated sprites run on intervals of miliseconds, and so they need to be timed accordingly to be convincing and accurate to their in-game depictions. You can either find or make a recording of the sprite playing in motion in-game to assist with this. The most ideal format for this is a video that allows you to advance frame by frame. This way, you can count how many frames a given sprite is meant to appear. (In some advanced cases, some sprite animations use the same sprite texture but change the position of the texture depending on the frame itself.)

Once you know how many frames appear for a given sprite, you can then divide the number of frames by the frame rate of the game to get the milisecond duration the given sprite should play at (rounded up and then multiplied by 1000). For instance, if a given texture plays for 8 frames in a 30 fps game, that comes out to 0.2666.... After rounding and multiplying, you get 270ms. Sprite textures generally advance at the same intervals, but this isn't always the case.

For this demonstration, we will be animating the idle sprite for Tingle from Cadence of Hyrule. The sprite sheet for this can be found at The Spriters Resource.

There are more sprites than we need from the sprite sheet given, so we need to condense it down to just what we need to work with. For this, you can use the Rectangle Select Tool in the toolbar.

We're still not done erasing all of the unnecessary bits, however. If you've downloaded the sprite sheet from somewhere else, you may need to add an alpha channel to make sure that the background won't appear white when you delete it.

When you're done with this, you should have a set of sprites on a transparent background (represented by a checkerboard pattern). In this example, we have a set of nine sprites that are a maximum of 22 pixels wide and 35 pixels high. These numbers are important as they will be the resolution we will work at when animating all of the sprites together. The maximum size of the gif you are working with should only be what is necessary for the sprite and the animation. Any unnecessary space will affect how the sprite displays, so be sure to find the maximum range of each sprite and go with the largest available.

To get started animating these sprite textures, you should open a new document in GIMP as a work space.

From here on, it's a matter of assembling all of the sprites in the appropriate order. Luckily, the sprite sheet provided lists all of the sprite textures in order, so all we have to do is copy and paste them from left to right on top of each other in the new document we created.

Once you've assembled all of your sprites, it is time to export the image as a gif. Note that specifically for sprites from Cadence of Hyrule, you should ideally time all of the sprites to match 400ms per animation loop. As this animation has 9 sprite textures, that would be 400/9, so roughly 44ms per frame (note that GIMP presently rounds this down to 40ms). This won't necessarily match the animation seen in-game but this is done for uniformity. See below for more details.

Once you've exported it, you now have a fully animated gif. However, as we're trying to upload an animated png instead, we're not finished. We need to convert the gif to png format. This can be done by visiting a website such as ezgif.com.

Note: because of the nature of the game, files from Cadence of Hyrule uploaded at an interval of 400ms/loop may not match their in-game counterparts. This is intentional, as it keeps images in our galleries uniform. They are set to match the speed of the field area of Cadence of Hyrule so that they all move in unison.